Compound Formats
This page describes the different compound date/time formats that the DateTimeImmutable, DateTime, date_create(), date_create_immutable(), and strtotime() parser understands.
DD
doy
frac
hh
HH
meridian
ii
II
M
MM
space
ss
SS
W
tzcorrection
hh
":"? II
?YY
dd
"/" M
"/" YY
: HH
":" II
":" SS
space
tzcorrection
YY
":" MM
":" DD
" " HH
":" II
":" SS
YY
"-"? "W" W
YY
"-"? "W" W
"-"? [0-7]YY
"-" MM
"-" DD
" " HH
":" II
":" SS
YY
"."? doy
YY
"-" MM
"-" DD
"T" HH
":" II
":" SS
frac
tzcorrection
?YY
MM
DD
"T" hh
":" II
":" SS
YY
MM
DD
't' hh
II
SS
YY
"-" mm
"-" dd
"T" hh
":" ii
":" ss
注意:
The "W" in the "ISO year with ISO week" and "ISO year with ISO week and day" formats is case-sensitive, you can only use the upper case "W".
The "T" in the SOAP, XMRPC and WDDX formats is case-sensitive, you can only use the upper case "T".
The "Unix Timestamp" format sets the timezone to UTC.
User Contributed Notes 2 notes
up down 2 Bilge at steam250 dot com ¶1 year ago
Unix timestamps also accept a microseconds specifier. e.g. @1607974647.503686 is valid and will be parsed as 2020-12-14 19:37:27.503686+00.
up
down
-3
tuxedobob ¶6 years ago
When trying to create a DateTime from a string, PHP essentially doesn't care about leading zeroes in hours.
When converting a DateTime to a string, PHP will honor leading zeroes as documented in date().
add a note
官方地址:https://www.php.net/manual/en/datetime.formats.compound.php