How to use the PHP date format generator
- Pick a common format, or type your own using PHP's format letters.
- Tap any letter in the tables to insert it where your cursor is. Each row shows what it prints right now.
- Use Add your own words for text such as "at" or "on". The letters are escaped with a backslash so PHP doesn't treat them as format codes.
- Copy the ready-made
date()orDateTime::format()code.
The preview follows PHP's own rules, including ISO week numbers, the English suffixes st, nd, rd and th, and time zone offsets. Pick a time zone and a date to see exactly what your server will print.
Worked example
The format l, jS F Y \a\t g:ia on January 1, 2026 at 5:30 in the morning prints:
Thursday, 1st January 2026 at 5:30am
lis the full day name andjSis the day with its suffix.F Yis the full month name and four-digit year.\a\tprints the word "at", andg:iais the 12-hour time with am or pm.
Time zone abbreviations (the T letter) come from your browser and can differ slightly from your server's time zone database for a few zones.