This tool runs entirely in your browser. Nothing you paste is uploaded.
How you can check →The Universal Date Format Generator
Time & DatePick the fields you want and get the exact format string for Python, Java, C#, Go, JavaScript, PHP or SQL — plus the traps each language hides. Or paste a date and work backwards to its pattern.
Start from a common format
Shown as real output, because the shape is easier to recognise than the name.
Your format
Click a field to change how it is written, drag it to move it, or use the cross in its corner to remove it. With one focused, Alt + ←/→ moves it and Delete removes it. Type between fields to add your own text.
Preview
Editable. Paste a pattern here in any language, then change the dropdown above to translate it.
Or work backwards from an example
Paste one timestamp, or several lines of a log. More lines means less guessing — a day above 12 settles whether the day or the month comes first.
No network activity while you use this tool Show the numbers
- Requests to any other server
- 0
- Requests since you started typing
- —
Counted live by your browser's own Performance Timeline — the same data the DevTools Network panel reads. It cannot see what a browser extension does, and it is not meant to replace checking for yourself: here is how, in thirty seconds .
A date format generator for every language, from one picker
Every language decided separately how to spell a date format, and the results only look
similar. Python writes %Y-%m-%d, Java writes yyyy-MM-dd, Go writes
2006-01-02, PHP writes Y-m-d and PostgreSQL writes
YYYY-MM-DD. Four of those are unrelated systems, and the fifth is a fourth system
that happens to agree in this one case. This tool lets you describe the output you want once
— year, then a hyphen, then a zero-padded month — and produces the exact
date format string for whichever of them you are writing today, along with a
runnable snippet.
The mistakes it is built to catch
Most format-string bugs do not throw. They produce a string that looks right, ships, and goes wrong later on a specific day or a specific machine. These are the ones this tool names as you build:
-
The week-numbering year.
YYYYin Java, Swift and date-fns is not the calendar year; it is the year that owns the ISO week the date falls in. On 31 December 2019 it renders 2020. Code using it works for around 360 days a year, which is exactly long enough to reach production. -
MySQL is not strftime. Minutes are
%i, and%Mis the full month name — so a pattern copied from a Python script intoDATE_FORMATreturns text rather than an error. -
%-dis a GNU extension. It strips the leading zero on Linux and macOS, does not exist in standard strftime, and is spelled%#dby Microsoft's runtime. -
.NET's
FFFchanges its own width. It suppresses trailing zeros and prints nothing at all when the milliseconds are zero, which quietly breaks anything parsing those logs by offset. - Spelled-out names follow the runtime's locale, not the pattern. The same code prints August on your laptop and Ağustos on a server set to Turkish. Every snippet here pins an invariant locale for that reason.
- Time-zone abbreviations are ambiguous. IST is +05:30 in India, +02:00 in Israel and +01:00 in Ireland. If a machine will read the string back, use the numeric offset — and if you need to reason about zones themselves, the world clock and time zone converter is the tool for that.
What each language cannot do
Some fields simply have no spelling in some languages, and the useful answer is to say so
rather than substitute the nearest-looking token. Go's layout language has
no week-number element at all; .NET has no day-of-year or week specifier;
SQLite ships no locale data and therefore has no month names; Intl.DateTimeFormat
chooses its own field order from the locale, so an exact layout needs
formatToParts. Where you pick a field the selected language cannot write, this
tool says which field, why, and what to call instead — it does not quietly drop it.
Working backwards from a date you already have
If you have the output and need the pattern — a column in a CSV, a line in a log —
paste it into the box at the bottom. The tool takes the string apart and proposes the format.
Where a date genuinely has two readings, such as 01/02/2026, it offers both rather
than picking one, because a wrong reading parses and sorts perfectly cleanly and has no
symptom. Paste several lines and the ambiguity usually resolves itself: one row with a day
above 12 proves the order for the whole set. The same reasoning drives the ambiguous-date
handling in the table workbench.
Common use cases
- Porting a timestamp format from an application into a SQL query, or the reverse
- Matching a log format so a parser, Logstash grok pattern or ingest pipeline lines up
- Producing an ISO 8601 or RFC 3339 string that a downstream API will actually accept
- Naming files with a sortable date stamp, and checking what it looks like before generating thousands of them
- Reading a timestamp out of an API response — and if it turns out to be a number, the epoch converter takes it from there
- Settling an argument about whether
YYYYoryyyyis correct
Everything happens in this tab
The patterns, the preview, the code snippets and the format detection are all computed by JavaScript running in your browser. Nothing you type is uploaded, logged or stored, and the example dates you paste — which are often real rows out of real systems — do not leave the machine you are sitting at.
Frequently asked questions
- Why does the same format string give different results in MySQL and Python?
- Because they only look alike. In Python's strftime, %M is the minute and %m is the month. In MySQL's DATE_FORMAT, %i is the minute and %M is the full month name — so '%H:%M' returns something like '14:August'. MySQL also uses %s for seconds rather than the Unix epoch, and %u for a week number rather than the weekday. This tool translates through fields rather than substituting characters, so those four collisions cannot happen.
- What is the difference between YYYY and yyyy?
- In Java, Swift and date-fns, yyyy is the calendar year and YYYY is the week-numbering year — the year that owns the ISO week a date falls in. They agree for about 360 days a year and disagree at the boundary: 31 December 2019 renders as 2019 with yyyy and 2020 with YYYY. Confusingly, Day.js and moment use YYYY for the ordinary calendar year. This tool treats them as two different fields and warns when you pick the week-numbering one without a week number beside it.
- Why does Go use 2006-01-02 instead of tokens?
- A Go layout is the output you want, written out for one specific reference instant: Mon Jan 2 15:04:05 MST 2006, whose parts are 1, 2, 3, 4, 5, 6 and -7 in order. So '2006-01-02' is a format string and so is 'Jan _2 3:04PM'. It reads as a puzzle once and is easy afterwards, but it has no escape syntax — a literal '2006' in your text really will be replaced with the year — and no week-number element at all.
- Can I paste a date and get the format instead?
- Yes. Paste one or more example timestamps into the box at the bottom and the tool works backwards to the pattern. Where a date could be read two ways — 01/02/2026 is 1 February in most of the world and 2 January in the United States — it offers both readings rather than picking one, and paste a few more lines and a day above 12 will settle it automatically.
- Why does my format work locally and break on the server?
- Almost always the locale. Spelled-out month names, weekday names and the AM/PM marker are resolved against the runtime's locale, not against the pattern, so the same code prints 'August' on your laptop and 'Ağustos' on a server set to Turkish — and in some locales the AM/PM marker is empty. Every code snippet on this page pins an invariant locale for that reason. The other common cause is %-d, a GNU extension that does not exist on Windows.
- Does anything I type here get uploaded?
- No. Every pattern, example date and generated snippet on this page is produced by JavaScript running in your browser. There is no server call, and the receipt below the tool measures that claim rather than asserting it.