Tools
Log in
English

Learn to codePHP

PHP date() format builder

PHP 8.3Runs in your browser

Build PHP date() format strings with a live preview and reverse lookup.

PHP date() format builder

Result

Common formats
CharMeaningNow
Day, 01 to 31
Day, 1 to 31
Weekday, 3 letters (Mon)
Weekday, full (Monday)
ISO weekday, Mon 1 to Sun 7
Weekday, Sun 0 to Sat 6
English ordinal suffix (st nd rd th)
Day of the year, from 0
ISO week number
Month name, full (January)
Month name, 3 letters (Jan)
Month, 01 to 12
Month, 1 to 12
Days in the month
1 in a leap year
Year, 4 digits
Year, 2 digits
ISO week-numbering year
am / pm
AM / PM
Hour, 1 to 12
Hour, 0 to 23
Hour, 01 to 12
Hour, 00 to 23
Minutes, 00 to 59
Seconds, 00 to 59
Milliseconds (000)
Microseconds (000000)
Swatch Internet time
Time zone identifier (Asia/Seoul)
Time zone abbreviation (KST)
UTC offset (+09:00)
UTC offset (+0900)
Like P, but Z for UTC
UTC offset in seconds
1 during daylight saving time
ISO 8601 date and time
RFC 2822 date and time
Seconds since 1970 (Unix time)

Reverse

Suggested format

    How to use

    1. Type format characters such as Y-m-d H:i:s and see the date() / DateTime::format() result for the chosen time and time zone at once.
    2. Click a character in the table below to append it. Each row shows its meaning and its current value.
    3. Type the shape you want into the reverse box (for example 2026/11/12 2:05 PM) to get a suggested format.
    4. Press Check with browser PHP to run the real DateTime::format() and compare.

    Good to know

    • To print a letter that is also a format character, put \ before it (\T, \a\t).
    • date() follows the default time zone (date.timezone). For a fixed zone write new DateTime('now', new DateTimeZone('Asia/Seoul')).
    • Day and month names are always English; translate them with your own array.
    • o is the ISO week-numbering year, which can differ from Y in late December and early January.

    Questions people ask

    What is the difference between m and i?

    m is the month (01 to 12) and i is minutes (00 to 59). Using m for minutes is a common slip.

    How do Y and o differ?

    Y is the calendar year; o is the year that goes with the ISO week number (W). They differ for a few days around New Year.

    How do I print Korean time?

    Create new DateTime('now', new DateTimeZone('Asia/Seoul')) or call date_default_timezone_set('Asia/Seoul') first.