DevBolt
Processed in your browser. Your data never leaves your device.

How do I test date format patterns online?

Enter a date format pattern (strftime, date-fns/Unicode, Go, or Java style) and see the formatted output for any date in real time. The tool shows a token reference table with all available format specifiers. Choose from common presets like ISO 8601 or RFC 2822. Everything runs in your browser.

Test strftime format
Input
Format: %Y-%m-%d %H:%M:%S
Date: March 19, 2026
Output
2026-03-19 14:30:00
← Back to tools

Date Format Tester

Test date format patterns for strftime, date-fns, Moment.js, Go, and Java. Enter a date and pattern to see the formatted output instantly.

Common Formats Preview

FormatPatternOutput
ISO 8601%Y-%m-%dT%H:%M:%S%z2026-03-21T08:02:47+0000
US Date%m/%d/%Y03/21/2026
EU Date%d/%m/%Y21/03/2026
Full Date + Time%A, %B %-d, %Y %I:%M %pSaturday, March 21, 2026 08:02 AM
Short Date + Time%Y-%m-%d %H:%M:%S2026-03-21 08:02:47
Time Only (12h)%I:%M:%S %p08:02:47 AM
Time Only (24h)%H:%M:%S08:02:47
RFC 2822%a, %d %b %Y %H:%M:%S %zSat, 21 Mar 2026 08:02:47 +0000

Click a row to use that pattern

Token Reference — strftime (Python, PHP, Ruby)

TokenDescriptionExample
%Y4-digit year2026
%y2-digit year26
%mMonth (01–12)03
%-mMonth (1–12)3
%BFull month nameMarch
%bAbbreviated monthMar
%dDay (01–31)18
%-dDay (1–31)18
%AFull weekdayWednesday
%aAbbreviated weekdayWed
%HHour 24h (00–23)14
%IHour 12h (01–12)02
%MMinute (00–59)05
%SSecond (00–59)09
%pAM/PMPM
%zUTC offset+0100
%ZTimezone nameEST
%jDay of year (001–366)077
%wWeekday (0=Sun)3
%sUnix timestamp1774070400
%%Literal %%

Quick Reference

strftime — Python (datetime.strftime), PHP (strftime), Ruby (Time#strftime), C. Unicode — date-fns (format), Moment.js, Day.js. Go — uses reference time Mon Jan 2 15:04:05 MST 2006. JavaSimpleDateFormat, Kotlin, Scala.

Tips & Best Practices

Pro Tip

ISO 8601 (YYYY-MM-DD) is the only unambiguous date format

01/02/03 means January 2 in the US, February 1 in Europe, and February 3 in some Asian countries. ISO 8601 (2024-01-02) is internationally unambiguous and sorts correctly as a string. Always use it for APIs, logs, and data exchange.

Common Pitfall

JavaScript's Date.parse() behavior varies across browsers

Date.parse('2024-01-15') returns different results depending on whether a time zone is included. Without a timezone suffix, some browsers treat it as UTC, others as local time. Always include timezone: '2024-01-15T00:00:00Z' for UTC.

Real-World Example

Go's time format uses a reference date, not symbols

Go formats dates using the reference time 'Mon Jan 2 15:04:05 MST 2006' — each component has a specific value (Jan=1, 2=day, 15=3PM, 04=minute, 05=second, 2006=year). It's unintuitive at first but eliminates ambiguity in format strings.

Security Note

Timezone-unaware dates cause authentication and billing bugs

A subscription that 'expires on January 15' — in which timezone? A user in UTC+12 loses access 12 hours before a user in UTC-12. Always store timestamps in UTC with timezone info, and convert to local time only for display.

Frequently Asked Questions

How do I test date format patterns in different programming languages?
Enter a date and a format pattern string to see the formatted output instantly. DevBolt's Date Format Tester supports format syntaxes from multiple ecosystems: strftime (Python, Ruby, C, PHP), moment.js/day.js (JavaScript), Go's reference-time format, and Java's DateTimeFormatter patterns. Each system uses different tokens. For example, a four-digit year is %Y in strftime, YYYY in moment.js, 2006 in Go, and yyyy in Java. The tool shows the result for your selected format system in real time and includes a reference table of all tokens.
What are the common date format tokens across programming languages?
Date format tokens vary significantly between languages. For year: %Y (strftime), YYYY (moment.js), 2006 (Go), yyyy (Java). For month: %m (strftime), MM (moment.js), 01 (Go), MM (Java). For day: %d (strftime), DD (moment.js), 02 (Go), dd (Java). For hours: %H for 24-hour (strftime), HH (moment.js), 15 (Go), HH (Java). Go is unique in using a reference date instead of symbolic tokens. The inconsistency between systems is a common source of bugs, which is why testing format strings before deployment is essential.
Why does Go use a reference date instead of format tokens?
Go uses the reference time Mon Jan 2 15:04:05 MST 2006 because each component has a unique numeric value: month 1, day 2, hour 15, minute 04, second 05, year 2006, timezone MST. This mnemonic sequence 1-2-3-4-5-6-7 makes it easier to remember than arbitrary tokens. To format a date, you write the reference time in the layout you want. For example, 2006-01-02 produces ISO dates. While unfamiliar to developers from other languages, it avoids ambiguity between similar tokens like mm (minutes) and MM (months) that frequently cause bugs in other format systems.

Related Inspect Tools