Skip to content
Marvin's Toolbox.

Date Format Tester

Test a date format string against any date and time zone, and see what every token means. Works with strftime, Go layouts, date-fns, Moment, Java, PHP and .NET patterns, and translates a format from one language to another.

Runs entirely in your browser. Nothing you put in here gets uploaded.

Pattern

Conversions start with %. Everything else prints as typed.

Year and eraMonth and quarterDayWeekdayHourMinuteSecondTime zone
Date
Time zone

Dates without an offset are read in this zone.

Language

Output

…

Token by token

TokenMeaningOutput
%a
Weekday name, abbreviated
…
%d
Day of the month, zero padded
…
%b
Month name, abbreviated
…
%Y
Yearglibc does not pad years below 1000, Ruby pads to four digits.
…
%H
Hour, 24 hour clock, zero padded
…
%M
Minute, zero padded
…
%S
Second, zero padded
…
%z
UTC offset as +hhmm
…

In other languages

strftime (GNU date, Python, Ruby)

%a, %d %b %Y %H:%M:%S %z

Go

Mon, 02 Jan 2006 15:04:05 -0700

date-fns

EEE, dd MMM yyyy HH:mm:ss xx

Moment

ddd, DD MMM YYYY HH:mm:ss ZZ

Java

EEE, dd MMM uuuu HH:mm:ss xx

PHP

D, d M Y H:i:s O

.NET

ddd, dd MMM yyyy HH:mm:ss zzz

  • %z: .NET has no token for this exact form. zzz is the nearest: UTC offset as +hh:mm.

Edge dates

The same pattern on dates that catch mistakes. Pick one to use it.

Token reference

Every strftime token. Pick one to insert it at the cursor.

Year and era

Month and quarter

Week

Day

Weekday

Hour

Minute

Second

AM or PM

Time zone

Timestamp

Shortcut

Next steps

Send this tool's output straight into another tool.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

Convert between scientific notation and full numbers as you type. Reads 1.23e5, 1.23 × 10^5 and plain numbers, shows the value written out, in normalized scientific notation and in engineering notation, and can round to any number of significant digits.

About the Date Format Tester Tool

This tool shows what a date format string really prints. Pick a language, type a pattern, and it renders against the current time or any date you choose, in any time zone and language. Each token in the pattern and its piece of the output share a color, and a table explains every token one by one.

It reads strftime with the differences between C, GNU date, Python and Ruby, Go reference time layouts, date-fns, Moment and Day.js, Java DateTimeFormatter, PHP date() and .NET format strings. Tokens that do not exist, or that belong to another language, get a message that says what went wrong, like YYYY in Java or %f in C.

Every pattern is also translated into all the other languages, with a preview of what the translation prints and a note for anything that has no equivalent. If you are moving code from one stack to another, this is the fast way to port a format string.

What you can do

  • Test a strftime format and see the output live
  • Check a Go time layout against the reference time
  • Convert a strftime format to a Go layout
  • Translate date format strings between Moment, date-fns, Java, PHP and .NET
  • Find out what each token in a date format means
  • Catch the YYYY and yyyy mix-up before it breaks around New Year
  • See which strftime codes work in Python, Ruby or plain C
  • Copy ISO 8601, RFC 3339 and RFC 2822 patterns for each language
  • Preview a format in any time zone and language
  • Try a pattern on dates that catch mistakes, like leap days and week 53

How to use the Date Format Tester

  1. 1Pick the language of your pattern at the top of the tool, and the flavor if it has one.
  2. 2Type a pattern, pick a preset, or insert tokens from the reference at the bottom.
  3. 3Leave the date on Now, or switch to a fixed date, then choose a time zone and a language.
  4. 4Read the output and go through the token table. Warnings above the output point at likely mistakes.
  5. 5Copy the pattern in another language from the translations, or open it there to keep working.

Why every language writes dates differently

strftime marks each conversion with a percent sign, so %Y-%m-%d is the year, month and day and everything else prints as typed. PHP uses single letters with no marker, and a backslash protects text. Moment, date-fns, Java and .NET repeat letters to set the width, so M is 3 and MM is 03, and they disagree on what the letters mean.

Go has no format letters at all. A layout is one fixed moment, Mon Jan 2 15:04:05 MST 2006, written the way the output should look. 02 is the day because the reference day is the 2nd, and 15 is the hour because the reference time is 3 PM. Go also has no escape, so literal text that spells a chunk like Jan always prints as a date value.

The mistakes that only show up on certain dates

YYYY in Java and date-fns and %G in strftime are the week-numbering year, not the calendar year. For most of the year the two match, then 30 December 2024 suddenly prints 2025. The edge dates in this tool show that kind of bug right away, because ISO week 1 can start in December and week 53 can run into January.

A 12 hour clock without AM or PM makes 03:00 and 15:00 identical. mm is minutes where MM is the month, and in Moment dd is the weekday while DD is the day of the month. In Java and date-fns DD is the day of the year, so it looks right in January and goes wrong from February on.

What a translation cannot carry over

Not every token exists everywhere. Go layouts have no ISO week and no Unix timestamp, so those need a call like t.ISOWeek() or t.Unix(). .NET has no offset without a colon, and PHP counts the day of the year from zero. When a token has a near match the translation uses it and says so, and when it has none the token is left out and flagged, often with the method to call instead.

Locale shortcuts like %c, L or P follow the language at runtime, so they translate to their fixed English layout. The preview under each translation renders the result with the target language's own rules, so a difference in the output is easy to spot. For plain timestamps, the Unix Timestamp Converter is the better fit.

Tools that share a tag with this one.

Encode and decode Base16, Base32, Base36, Base45, Base58, Base62, Base64 and Base85. Pick the alphabet variant you need, from Crockford Base32 to Bitcoin Base58 and Ascii85, and convert in either direction.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.

Open a CSV or TSV file and read it as a proper table. Sort by any column, filter rows with a search or per-column conditions, hide columns you do not need, and copy or download what is left.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.