To use a conditional expression in your prompt, use the following escape sequence and syntax:
The rest comes straight from the man page...
Specifies a ternary expression. The character follow- ing the x is arbitrary; the same character is used to separate the text for the `true' result from that for the `false' result. This separator may not appear in the true-text, except as part of a %-escape sequence. A `)' may appear in the false-text as `%)'. true-text and false-text may both contain arbitrarily-nested escape sequences, including further ternary expres- sions. The left parenthesis may be preceded or followed by a positive integer n, which defaults to zero. The test character x may be any of the following: c . ~ True if the current path, with prefix replacement, has at least n elements. / C True if the current absolute path has at least n elements. t True if the time in minutes is equal to n. T True if the time in hours is equal to n. d True if the day of the month is equal to n. D True if the month is equal to n (January = 0). w True if the day of the week is equal to n (Sunday = 0). ? True if the exit status of the last command was n. # True if the effective uid of the current process is n. g True if the effective gid of the current process L True if the SHLVL parameter is at least n. S True if the SECONDS parameter is at least n. v True if the array psvar has at least n elements. _ True if at least n shell constructs were started. ! True if the shell is running with privileges.