The date and time formats may be parsed and manipulated with functions strtotime()
, date_create()
, etc... These date and time formats are listed in table below.
Description |
Format |
Examples |
---|---|---|
daysuf |
"st" | "nd" | "rd" | "th" |
|
dd |
([0-2]?[0-9] | "3"[01]) daysuf? |
"7th", "22nd", "31" |
DD |
"0" [0-9] | [1-2][0-9] | "3" [01] |
"07", "31" |
m |
'january' | 'february' | 'march' | 'april' | 'may' | 'june' | 'july' | 'august' | 'september' | 'october' | 'november' | 'december' | 'jan' | 'feb' | 'mar' | 'apr' | 'may' | 'jun' | 'jul' | 'aug' | 'sep' | 'sept' | 'oct' | 'nov' | 'dec' | "I" | "II" | "III" | "IV" | "V" | "VI" | "VII" | "VIII" | "IX" | "X" | "XI" | "XII" |
|
M |
'jan' | 'feb' | 'mar' | 'apr' | 'may' | 'jun' | 'jul' | 'aug' | 'sep' | 'sept' | 'oct' | 'nov' | 'dec' |
|
mm |
"0"? [0-9] | "1"[0-2] |
"0", "04", "7", "12" |
MM |
"0" [0-9] | "1"[0-2] |
"00", "04", "07", "12" |
y |
[0-9]{1,4} |
"00", "78", "08", "8", "2008" |
yy |
[0-9]{2} |
"00", "08", "78" |
YY |
[0-9]{4} |
"2000", "2008", "1978" |
American month and day |
mm "/" dd |
"5/12", "10/27" |
American month, day and year |
mm "/" dd "/" y |
"12/22/78", "1/17/2006", "1/17/6" |
Four digit year, month and day with slashes |
YY "/" mm "/" dd |
"2008/6/30", "1978/12/22" |
Four digit year and month (GNU) |
YY "-" mm |
"2008-6", "2008-06", "1978-12" |
Year, month and day with dashes |
y "-" mm "-" dd |
"2008-6-30", "78-12-22", "8-6-21" |
Day, month and four digit year, with dots, tabs or dashes |
dd [.\t-] mm [.-] YY |
"30-6-2008", "22.12\t1978" |
Day, month and two digit year, with dots or tabs |
dd [.\t] mm "." yy |
"30.6.08", "22\t12\t78" |
Day, textual month and year |
dd ([ \t.-])* m ([ \t.-])* y |
"30-June 2008", "22DEC78", "14 III 1879" |
Textual month and four digit year (Day reset to 1) |
m ([ \t.-])* YY |
"June 2008", "DEC1978", "March 1879" |
Four digit year and textual month (Day reset to 1) |
YY ([ \t.-])* m |
"2008 June", "1978-XII", "1879.MArCH" |
Textual month, day and year |
m ([ .\t-])* dd [,.stndrh\t ]+ y |
"July 1st, 2008", "April 17, 1790", "May.9,78" |
Textual month and day |
m ([ .\t-])* dd [,.stndrh\t ]* |
"July 1st,", "Apr 17", "May.9" |
Day and textual month |
d ([ .\t-])* m |
"1 July", "17 Apr", "9.May" |
Month abbreviation, day and year |
M "-" DD "-" y |
"May-09-78", "Apr-17-1790" |
Year, month abbreviation and day |
y "-" M "-" DD |
"78-Dec-22", "1814-MAY-17" |
Year (and just the year) |
YY |
"1978", "2008" |
Textual month (and just the month) |
m |
"March", "jun", "DEC" |
|
|
|
frac |
. [0-9]+ |
".21342", ".85" |
hh |
"0"?[1-9] | "1"[0-2] |
"04", "7", "12" |
HH |
[01][0-9] | "2"[0-4] |
"04", "7", "19" |
meridian |
[AaPp] .? [Mm] .? [\0\t ] |
"A.m.", "pM", "am." |
MM |
[0-5][0-9] |
"00", "12", "59" |
II |
[0-5][0-9] |
"00", "12", "59" |
space |
[ \t] |
|
tz |
"("? [A-Za-z]{1,6} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+ |
"CEST", "Europe/Amsterdam", "America/Indiana/Knox" |
Comments
No comments have been made yet.
Please login to leave a comment. Login now