Usage with php datetime object or Carbon​
Character | Description | Example |
H | 24-hour format of an hour with leading zeros | 00 through 23 |
G | 24-hour format of an hour without leading zeros | 0 through 23 |
h | 12-hour format of an hour with leading zeros | 01 through 12 |
g | 12-hour format of an hour without leading zeros | 1 through 12 |
a | Lowercase Ante meridiem and Post meridiem |
|
A | Uppercase Ante meridiem and Post meridiem |
|
Character | Description | Example |
i | Minutes with leading zeros | 00 through 59 |
s | Seconds with leading zeros | 00 through 59 |
u | Microseconds | eg 123456 |
v | Milliseconds | eg 654 |
Character | Description | Example |
d | Day of the month, 2 digits with leading zeros | 01 through 31 |
j | Day of the month without leading zeros | 1 through 31 |
D | Textual representation of a day, three letters | Mon through Sun** |
l | (lowercase L) Full textual representation of a day of the week | Monday through Sunday ** |
N | ISO-8601 numeric representation of the day of the week | 1 through 7 (mon=1) |
S | English ordinal suffix for the day of the month | st, nd, rd, or th |
w | Numeric representation of the weekday | 0 (sun) through 6 |
z | The day of the year (zero index for Jan 1) | 0 through 365 |
Character | Description | Example |
W | ISO-8601 week number of year, weeks starting on Monday | Example: 42 (the 42nd week in the year) |
Character | Description | Example |
m | Numeric representation of a month, with leading zeros | 01 through 12 |
n | Numeric representation of a month, without leading zeros | 1 through 12 |
M | A short textual representation of a month, three letters | Jan through Dec ** |
F | A full textual representation of a month, such as January or March | January through December |
t | The number of days in the given month | 28 through 31 |
Character | Description | Example |
Y | a four digit numeric representation of the year | 2020 or 1999 |
y | a two digit numeric representation of the year | 20 or 99 |
L | Whether it is a leap year | 1 for leap year, 0 otherwise |
o | ISO-8601 week-numbering year. 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. | 2020 or 1999 |
** can be varied through localisation
Character | Description | Example |
c | ISO 8601 Full Date Time |
|
r | ​ RFC 2822 formatted date |
|
U | Seconds since the Unix Epoch (commonly referred to as timestamp format) | 1593175400 |