Data lookups

Date-format codes

Date and time tokens for PHP, JavaScript, Python and Excel.

All lookups

34 entries.

MeaningPHP date()JavaScript (Intl / date-fns)Python strftimeExcel format
4-digit year Y yyyy %Y yyyy
2-digit year y yy %y yy
Month, 2 digits m MM %m mm
Month, no leading zero n M %-m (Linux) m
Month name, full F MMMM %B mmmm
Month name, short M MMM %b mmm
Day of month, 2 digits d dd %d dd
Day of month, no zero j d %-d (Linux) d
Weekday name, full l EEEE %A dddd
Weekday name, short D EEE %a ddd
Day of year z (0-based) DDD %j (1-based) (formula)
Week number W (ISO) ww %V (ISO) (formula)
Hour 24, 2 digits H HH %H hh (with h:mm)
Hour 24, no zero G H %-H (Linux) h
Hour 12, 2 digits h hh %I hh AM/PM
Hour 12, no zero g h %-I (Linux) h AM/PM
Minutes i mm %M mm
Seconds s ss %S ss
Milliseconds v SSS %f (microseconds) .000
AM / PM uppercase A a %p AM/PM
am / pm lowercase a a (lower manually) am/pm
Timezone abbreviation T zzz %Z (none)
Timezone offset O (+0100) / P (+01:00) XXX %z (none)
Timezone name e VV (via zoneinfo) (none)
Unix timestamp U Date.now()/1000 %s (formula)
ISO 8601 datetime c yyyy-MM-dd'T'HH:mm:ssXXX %Y-%m-%dT%H:%M:%S%z yyyy-mm-ddThh:mm:ss
RFC 2822 (email) r (toUTCString) %a, %d %b %Y %H:%M:%S %z (none)
Ordinal suffix S (st, nd, rd, th) (manual) (manual) (none)
Days in month t (manual) (calendar.monthrange) (formula)
Leap year flag L (manual) (calendar.isleap) (formula)
UK short date d/m/Y dd/MM/yyyy %d/%m/%Y dd/mm/yyyy
US short date m/d/Y MM/dd/yyyy %m/%d/%Y mm/dd/yyyy
Full UK date l j F Y EEEE d MMMM yyyy %A %-d %B %Y dddd d mmmm yyyy
MySQL datetime Y-m-d H:i:s yyyy-MM-dd HH:mm:ss %Y-%m-%d %H:%M:%S yyyy-mm-dd hh:mm:ss
PHP and Python tokens differ sharply — PHP's "d" and Python's "%d" agree, but many others do not. Always test with a known date.