syntax:functions:format
This is an old revision of the document!
format(date_as_number, format)
Converts date_as_number into a text string according to a format string.
| Example | Result | Notes |
|---|---|---|
| format(41640,'yyyyMMdd') | 20140101 | 41640 corresponds to January 1st, 2014 |
| format(41640,'yy-MM-dd') | 14-01-01 | 41640 corresponds to January 1st, 2014 |
Format string components
A format string defines a formatting template for dates. Its components can be put together in any combination. If a character doesn't belong to a format component then it's inserted verbatim.
Note that the colon (":") is not a valid symbol for file names and therefore mustn't be used in file names generated using a format string.
Attention The format components are case sensitive. For instance, "MM" (uppercase) and "mm" (lowercase) are frequently confused by new EasyMorph users but they denote different data/time components (see table below).
| Character | Description |
|---|---|
| y | The year, from 0 to 99. |
| yy | The year, from 00 to 99. |
| yyyy | The year as a four-digit number. |
| M | The month, from 1 through 12. |
| MM | The month, from 01 through 12. |
| MMM | The abbreviated name of the month. |
| MMMM | The full name of the month. |
| d | The day of the month, from 1 through 31. |
| dd | The day of the month, from 01 through 31. |
| ddd | The abbreviated name of the day of the week. |
| h | The hour, using a 12-hour clock from 1 to 12. |
| hh | The hour, using a 12-hour clock from 01 to 12. |
| H | The hour, using a 24-hour clock from 1 to 24. |
| HH | The hour, using a 24-hour clock from 01 to 24. |
| m | The minute, from 0 through 59. |
| mm | The minute, from 00 through 59. |
| s | The second, from 0 through 59. |
| ss | The second, from 00 through 59. |
| tt | The localized AM/PM designator. |
See also
syntax/functions/format.1575625533.txt.gz · Last modified: by andrew