Sets the format used for timestamps retrieved from the database.
A string composed of the symbols listed below.
'YYYY-MM-DD HH:NN:ss.SSS'
The format is a string using the following symbols:
Symbol |
Description |
---|---|
yy |
Two-digit year |
yyyy |
Four-digit year |
mm |
Two-digit month, or two digit minutes if following a colon (as in 'hh:mm') |
mmm |
Three-character short form for name of the month of year |
mmmm[m...] |
Character long form for month name—as many characters as there are m's, until the number of m’s specified exceeds the number of characters in the month’s name. |
dd |
Two-digit day of month |
ddd |
Three-character short form for name of the day of week |
dddd[d...] |
Character long form for day name—as many characters as there are d's, until the number of d’s specified exceeds the number of characters in the day’s name. |
hh |
Two-digit hours |
nn |
Two-digit minutes |
ss.SSS |
Seconds (ss) and fractions of a second (SSS), up to six decimal places. Not all platforms support timestamps to a precision of six places. |
aa |
Am or pm (12 hour clock) |
pp |
Pm if needed (12 hour clock) |
Each symbol is substituted with the appropriate data for the date being formatted. Any format symbol that represents character rather than digit output can be put in uppercase which will cause the substituted characters to also be in uppercase. For numbers, using mixed case in the format string will suppress leading zeros.
Note that multibyte characters are not supported in format strings. Only single-byte characters are allowed, even when the collation order of the database is a multibyte collation order like 932JPN. See the section “DATE_FORMAT option” for more information.