| Format Character | Description | Returned Values |
|---|---|---|
| HOUR | ||
| H | 24-hr format with leading zero | 00 - 23 |
| G | 24-hr format without leading zero | 1 - 23 |
| h | 12-hr format with leading zero | 01 - 12 |
| g | 12-hr format without leading zero | 1 - 12 |
| a | Lowercase Ante meridiem and Post meridiem | am/pm |
| A | Uppercase Ante meridiem and Post meridiem | AM/PM |
| Minutes and Seconds | ||
| i | Minutes with leading zeros | 00 - 59 |
| s | Seconds with leading zeros | 00 - 59 |
| Timezone | ||
| O (Cap O) |
Difference to Greenwich time (GMT) in hours | Example: +0200 |
| Z (Cap Z) |
Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. | -43200 - 43200 |
| T | Timezone setting of this machine | Examples: EST, MDT … |
| I (Cap i) |
Whether or not the date is in daylights savings time | 1 if Daylight Savings Time, 0 otherwise. |
| Format Character | Description | Returned Values |
|---|---|---|
| Day of Week | ||
| l (lower L) |
A full textual representation of the day of the week | Moday - Sunday |
| D | A textual representation of a day, three letters | Mon - Sun |
| w | Numeric representation of the day of the week | 0 (for Sunday) - 6 (for Saturday) |
| Day of Month | ||
| d | Day of the month with leading zeros | 01 - 31 |
| j | Day of the month without leading zeros | 1 - 31 |
| S (Cap s) |
English ordinal suffix for the day of the month | st, nd, rd or th (1st, 2nd, 3rd, 4th...) |
| t | Number of days in the given month | 28 - 31 |
| Month | ||
| F | A full textual representation of a month, such as January or March | January - December |
| M | A short textual representation of a month, three letters | Jan - Dec |
| m | Numeric representation of a month, with leading zero | 01 - 12 |
| n | Numeric representation of a month, without leading zero | 1 - 12 |
| Year | ||
| Y | A full numeric representation of a year, 4 digits | 1999, 2000, 2001 etc |
| y | A two digit representation of a year | 99, 00, 01 etc |
| L | Whether it's a leap year | 1 if it is a leap year, 0 otherwise. |
| W | ISO-8601 week number of year, weeks starting on Monday | Example: 42 (the 42nd week in the year) |
| z (lower Z) |
The day of the year (starting from 0) | 0 - 365 |
| Preformatted | ||
| r | RFC 2822 formatted date. Equivalent to ‘D, j M Y H:i:s O’. | Example: Thu, 21 Dec 2000 16:01:07 +0200 |
| U (Cap u) |
Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) | time() |
| B | Swatch Internet time | 000 - 999 |