The DATE_FORMAT function returns a string based on the supplied datetime value
DATE_FORMAT(datetime, format)
Where [format] is a string made up of one or more of the following characters:
Category | Character | Description | Output examples | Days | d | Day of the month, 2 digits with leading zeros | 01 to 31 | D | A textual representation of a day, three letters | * Mon to Sun | j | Day of the month without leading zeros | 1 to 31 | l (lowercase 'L') | A full textual representation of the day of the week | * Sunday to Saturday | w | Numeric representation of the day of the week | 0 (for Sunday) to 6 (for Saturday) | z | Day of the year, 3 digits with leading zeroes | 001 to 365 | Weeks | W | ISO-8601 week number of year, weeks starting on Monday | 42 (the 42nd week in the year) | Months | F | A full textual representation of a month | * January to December | m | Numeric representation of a month, with leading zeros | 01 to12 | M | A short textual representation of a month, three letters | * Jan to Dec | n | Numeric representation of a month, without leading zeros | 1 to12 | Years | o | ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. | 1999 or 2003 | Y | A full numeric representation of a year, 4 digits | 1999 or 2003 | y | A two digit representation of a year | 99 or 03 | Time | A | Uppercase Ante meridiem and Post meridiem | AM or PM | g | 12-hour format of an hour without leading zeros | 1 to 12 | G | 24-hour format of an hour without leading zeros | 0 to 23 | h | 12-hour format of an hour with leading zeros | 01 to 12 | H | 24-hour format of an hour with leading zeros | 00 to 23 | i | Minutes with leading zeros | 00 to 59 | s | Seconds, with leading zeros | 00 to 59 |
* The day and month names use the text specified in the Query's Behavior Editor. This allows you to translate them into different languages. The Behavior Editor fields can also be linked to take their values from themes - thus allowing you to provide different users with different languages depending on their individual preferences.
Using other characters Including characters other than those listed above in the format string is nor supported: they may render verbatim, but if such a character is later used to provide a date expansion then the result will change. Instead, you should use string concatenation, for example:
"Day: " || DATE_FORMAT([date], 'D')
|