Tools / PHP date() Format Tester

PHP date() Format Tester.

Preview PHP date() and DateTime::format() strings with a breakdown of every format character.

Runs in your browser

YYYY-MM-DD HH:MM:SS, ISO 8601 with an offset, or a Unix timestamp. Empty uses the current time.

Fixed offsets only, like +02:00 or -05:30. Named zones such as Europe/Kyiv and DST are not applied.

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Result
Format characters

About PHP date() Format Tester

PHP date() Format Tester shows what a format string produces before you put it in code. Type a format such as Y-m-d H:i:s or l, jS F Y and the tool renders it for the date you enter, or for the current time when the date field is empty, using the same rules as PHP's date() and DateTime::format(). Below the result, a table lists every format character you used with its meaning and value, which makes it easy to spot the classic mixups: m is the month but i is the minute, h is the 12-hour hour while H is the 24-hour one, y has two digits and Y four, and D is a short day name while d is the day number. Escape letters you want printed literally with a backslash, so \a\t prints "at" instead of "am" followed by seconds. The ISO helpers are covered too: W is the ISO week number and o is the ISO year, which differs from Y in the last days of December and the first days of January, a common source of bugs in weekly reports. c gives ISO 8601, r gives RFC 2822 and U gives the Unix timestamp. Timezones are applied as fixed UTC offsets such as +02:00; named zones like Europe/Kyiv and their daylight saving rules are not resolved, so T shows GMT+0200 and I is always 0. For Carbon, the same characters work in format(); isoFormat() uses a different syntax. Everything is calculated in your browser.

How to Use

  1. Type a PHP format string; backslash-escape letters you want to print literally.
  2. Enter a date, an ISO 8601 timestamp or a Unix timestamp, and a UTC offset, or leave the date empty for now.
  3. Read the result and the per-character breakdown, then copy the format into your code.

Frequently Asked Questions

Why does W show week 53 or week 1 at the turn of the year?

W follows ISO 8601, where week 1 is the week that contains the first Thursday of the year. Use o, not Y, next to W so that the year matches the week.

What is the difference between date() and DateTime::format() here?

They share the same characters. date() always prints 000000 for u (microseconds) and 000 for v; this tool takes milliseconds from the date you enter, like DateTime::format() does.

Are named timezones supported?

No, only fixed offsets. The tool does not ship the timezone database, so it cannot apply daylight saving time for zones like Europe/Berlin. Enter the offset that applies on that date.

Does this run PHP?

No. It is a JavaScript implementation of the format characters that runs in your browser and matches PHP's output for fixed offsets.

Related Tools