godz.online
Back to tools

TLDR reference

Date format tokens

A searchable reference for date and time format tokens, with the PHP date() and C/strftime token side by side and an example each. Type to search, or filter by part of the date. Everything runs in your browser.

35 shown

How it works

A searchable reference for date and time format tokens, with the PHP date() token and the C/strftime token shown side by side and an example of what each produces. Building a date string means assembling these little placeholders - Y for a four-digit year, m for a zero-padded month, H for a 24-hour hour - and the awkward part is that different systems spell the same idea differently. Type to search by what you want, such as "month name" or "timezone", or use the chips to browse one part of the date at a time.

Both column styles are covered because you meet both: PHP date() uses bare letters, while strftime is the convention behind C, the shell date command, Python, and many others. Each row gives an example rendered for the same instant, so you can see at a glance that F gives "June" while M gives "Jun". A dash means that system has no single direct token. Everything is static and runs in your browser, so the lookup is instant and works offline.

Example. To build 2026-06-16 you combine Y-m-d in PHP, which is %Y-%m-%d in strftime. Searching "weekday" shows that l gives the full name "Tuesday" (strftime %A) while D gives the short "Tue" (strftime %a), and N gives the ISO weekday number 2.

FAQ

What is the difference between the PHP date() and strftime token styles?

They are two different conventions for the same job. PHP date() uses single letters with no prefix, so a four-digit year is simply Y and a zero-padded day is d. The strftime style, which comes from the C standard library and is used by the Unix date command, Python's strftime, and many other languages, prefixes each token with a percent sign, so the same year is %Y and the day is %d. This reference lines them up row by row so you can translate a format string from one world to the other.

How do I get a zero-padded versus an unpadded number?

Most date parts come in both forms. In PHP date(), the padded and unpadded versions use different letters: m is the month 01-12 while n is 1-12, and d is the day 01-31 while j is 1-31. In strftime the padded token is the default, such as %m, and the unpadded form is the GNU extension %-m (a hyphen after the percent sign), which is not available everywhere. When portability matters, prefer the padded forms.

What is ISO 8601 and how do I produce it?

ISO 8601 is the international standard for writing dates and times in an unambiguous, sortable way, such as 2026-06-16 for a date and 2026-06-16T14:05:09+02:00 for a full timestamp with offset. It is the format you should use for storage, APIs, and anything machine-read. In PHP the c token (or the constant DateTime::ATOM) emits a full ISO 8601 string directly, and Y-m-d gives just the date part.

Is PHP's strftime() function still available?

The strftime() and gmstrftime() functions were deprecated in PHP 8.1 and removed in PHP 9.0, so for PHP code you should format dates with the date() function or the IntlDateFormatter class instead. The strftime token style itself is far from dead, though - it is exactly what you use with the shell date command, Python, C, and countless other tools, which is why this reference keeps both columns side by side.