Date Formatter

Show any date in any pattern, with code snippets.

Runs locallyYour input is processed in this tab. The editor blocks outgoing network requests.

The Date Formatter shows any date in any pattern you write, using Unicode LDML tokens like yyyy-MM-dd HH:mm. It parses ISO 8601, RFC 2822, epoch values and everyday forms, lists 12 common formats at once, and gives matching JavaScript, Python, Java and SQL code. Everything runs in your browser — nothing is uploaded.

How to format a date

  1. Type or paste a date — 2026-09-26T14:05:00+05:30, 26 Sep 2026 14:05 or 1790409600 all work — or press Now. The parsed value is echoed below in ISO 8601 so you can confirm it was read correctly.
  2. Choose a time zone, then write a pattern or build one with the token chips (Year, Month name, Day, Weekday, Hour 12/24, Minute, AM/PM, Offset). Each chip shows its live value.
  3. Copy the result, copy any row in the preset table, or open the Code snippets tab for the same pattern in your language.

Examples

Every example formats the instant 2026-09-26T14:05:00+05:30 in the Asia/Kolkata time zone.

Common patterns

Pattern Output
yyyy-MM-dd HH:mm 2026-09-26 14:05
EEEE, d MMMM yyyy Saturday, 26 September 2026
dd MMM yyyy, h:mm a 26 Sep 2026, 2:05 PM
do MMMM yyyy 26th September 2026
'Week' II, yyyy Week 39, 2026
QQQ yyyy Q3 2026
EEE, dd MMM yyyy HH:mm:ss xx Sat, 26 Sep 2026 14:05:00 +0530

The preset table

Below the main output, the same instant appears in standard formats, each with its own Copy button:

Text
ISO 8601           2026-09-26T14:05:00+05:30
ISO 8601 (UTC)     2026-09-26T08:35:00.000Z
RFC 2822           Sat, 26 Sep 2026 14:05:00 +0530
RFC 3339           2026-09-26 14:05:00+05:30
US                 09/26/2026
European           26/09/2026
Indian             26-09-2026
Long form          Saturday, 26 September 2026 at 2:05 PM
Unix seconds       1790411700
Unix milliseconds  1790411700000
SQL DATETIME       2026-09-26 14:05:00
HTTP date          Sat, 26 Sep 2026 08:35:00 GMT

A Relative row ("3 days ago") is also shown; it depends on the current time.

Code snippets for dd MMM yyyy, h:mm a

The token translation is generated from one mapping table, so every language prints the same result. Notes appear only on the languages they concern — here, the Python snippet adds "%-d style (no padding) works on Linux and macOS; on Windows use %#d."

Python
dt.astimezone(ZoneInfo("Asia/Kolkata")).strftime("%d %b %Y, %-I:%M %p")
SQL
SELECT to_char(created_at AT TIME ZONE 'Asia/Kolkata', 'DD Mon YYYY, FMHH12:MI AM');

Options explained

The Date Formatter is a form, not an editor, so it has no settings drawer. These are its controls:

  • Input date — free text; accepts ISO 8601 and RFC 3339, RFC 2822 and HTTP dates, Unix seconds or milliseconds, yyyymmddThhmmssZ, 03/04/2026, 26 Sep 2026 14:05 and Sep 26, 2026 2:05 PM. Now fills in the current moment.
  • Time zone — a searchable IANA list defaulting to your browser's zone, with deprecated names such as Asia/Calcutta shown as Asia/Kolkata. Inputs without an offset are read in it, and output is shown in it; a second optional zone converts to another region.
  • Pattern — LDML tokens as used by date-fns and Java; wrap literal words in single quotes, as in 'Week' II.
  • Token chips — insert a token at the cursor, showing what it prints for the current date.
  • Read as — appears only for ambiguous inputs like 03/04/2026, letting you choose 4 March or 3 April.
  • Code snippets — JavaScript (date-fns and Intl), Python strftime, Java DateTimeFormatter, MySQL DATE_FORMAT and PostgreSQL to_char.

Common date format mistakes

YYYY prints the wrong year in late December

YYYY is the week-numbering year, not the calendar year. It matches yyyy for most of the year, then jumps early: with YYYY-MM-dd, 28 Dec 2026 prints 2027-12-28. The pattern field marks it in red with "YYYY is week-numbering year; you probably want yyyy."

mm prints minutes instead of the month

Lowercase mm is minutes; uppercase MM is the month. yyyy-mm-dd on 26 Sep 2026 at 14:05 prints 2026-05-26. The field warns whenever mm appears next to date tokens with no hour.

DD prints a three-digit number

DD is the day of the year, so DD/MM/yyyy gives 269/09/2026. Use dd for the day of the month.

03/04/2026 is read as the wrong day

Slash dates are ambiguous. When both numbers are 12 or less, 03/04/2026 is read month-first as 4 March, while dotted or dashed forms such as 03.04.2026 are read day-first as 3 April; the Read as toggle switches between them. A number above 12 settles it automatically, so 13/04/2026 is always 13 April.

hh shows 02 for two in the afternoon

hh is the 12-hour clock, so without a the output cannot tell morning from afternoon. The field warns: "hh is the 12-hour clock; add a for AM/PM or use HH for 24-hour time."

Letters in the pattern turn into numbers

Every ASCII letter is a potential token. Quote literal text — 'at', 'Week' — and write '' for a single apostrophe.

"Couldn't read this date"

The input did not match a known form, or it names a day that does not exist: 2026-02-30 is rejected rather than rolled over to 2 March. Try 2026-09-26 or 26 Sep 2026; the output keeps the last valid value greyed out until the input parses again.

FAQ

What is the difference between yyyy and YYYY?

yyyy is the calendar year. YYYY is the week-numbering year, which belongs to whichever year owns the week containing the date. They differ only in the last or first few days of a year, which is why the bug usually reaches production and appears in the last week of December. Use yyyy unless you are printing week numbers. See date format patterns across languages.

How do I format a date as ISO 8601?

Use yyyy-MM-dd'T'HH:mm:ssxxx for a local time with an offset, such as 2026-09-26T14:05:00+05:30, or copy the ISO 8601 (UTC) preset for the Z form. In JavaScript, date.toISOString() always returns UTC with milliseconds. ISO 8601 explained covers week dates, ordinal dates and how RFC 3339 differs.

Why does the same pattern differ between languages?

Each ecosystem has its own tokens. yyyy-MM-dd in date-fns or Java is %Y-%m-%d in Python and MySQL, and YYYY-MM-DD in PostgreSQL, where YYYY does mean the calendar year. The Code snippets tab translates your pattern so you do not have to remember each table.

How do I show a date in the Indian dd-MM-yyyy format?

Use the pattern dd-MM-yyyy, or copy the Indian preset, which gives 26-09-2026. For a slash-separated form use dd/MM/yyyy. Choose Asia/Kolkata as the time zone if the underlying value is stored in UTC, otherwise late-evening UTC times will show the previous day.

Can I format a Unix timestamp here?

Yes. Paste the epoch value into the input; 10-digit values are read as seconds and 13-digit values as milliseconds, and a fractional value such as 1790409600.5 is read as seconds. For the reverse — a date to epoch, or a closer look at units — use the Unix Timestamp Converter.

Does the formatter store the dates I enter?

No. Parsing and formatting happen in your browser inside an isolated frame that blocks network requests. Your pattern and time zone are remembered on this device so the page opens ready to use; the dates themselves are not kept unless you turn on "Remember my last input".

Pattern token reference

Token Meaning Example
yyyy / yy Calendar year 2026 / 26
MM / MMM / MMMM Month number, short, long 09 / Sep / September
dd / d / do Day of month, unpadded, ordinal 26 / 26 / 26th
EEE / EEEE Weekday short, long Sat / Saturday
HH / hh / h Hour 0–23, 01–12, 1–12 14 / 02 / 2
mm / ss / SSS Minute, second, millisecond 05 / 00 / 000
a AM/PM PM
xxx / xx UTC offset +05:30 / +0530
Q / II Quarter, ISO week number 3 / 39

Convert the same moment between cities with the Time Zone Converter, turn it into "3 days ago" with the Relative Time Formatter, or format a span like PT1H30M with the Duration Formatter. More tools live under Date & Number.

Browse all Date, Time & Number Formatting

Guides