Date formatter
Format any date or timestamp with tokens like YYYY-MM-DD HH:mm:ss, in local time or UTC. Includes presets, ISO week numbers, day of year and month names.
About Date formatter
The date formatter turns a date or Unix timestamp into text that follows a pattern you write, using tokens such as YYYY, MM, DD, HH and mm familiar from Moment.js and Day.js. Leave the input empty to format the current time, which updates every second, or enter a timestamp or ISO date to format a specific moment.
Presets cover common formats such as ISO 8601, DD/MM/YYYY, MM/DD/YYYY and RFC 2822-style dates, and a token table shows what each token produces for your date; select a token to add it to the pattern. Switch between Local and UTC to see the same moment in your time zone or in Coordinated Universal Time.
How to use Date formatter
- Enter a timestamp or date in the input field, or leave it empty to use the current time.
- Choose a preset, or type a pattern such as YYYY-MM-DD HH:mm:ss in the Pattern field.
- Select tokens in the table to add them to the end of the pattern, and wrap literal text in square brackets.
- Switch between Local and UTC, then copy the result.
Features
- Supports 29 tokens, including YYYY, MMMM, DD, dddd, HH, hh, A, SSS and the time zone offsets Z and ZZ.
- Includes Q for quarter, DDD for day of year and W for ISO week number.
- Outputs Unix seconds with X and milliseconds with x.
- Writes month and weekday names in the language of the page.
- Offers nine presets, from YYYY-MM-DD to h:mm A.
- Shows the value of every token for the current date in a reference table.
Common uses
- Working out the format string to use with Moment.js or Day.js.
- Creating consistent dates for file names, reports or log messages.
- Turning a timestamp into a readable date for documentation or a support reply.
- Checking how a date appears in UTC compared with local time.
Tips
- Use YYYY-MM-DD for file names and sortable text: dates in that format sort correctly as plain text.
- W is the ISO week number, but YYYY is the calendar year. In the first days of January the week can belong to the previous year, so check dates near New Year.
Frequently asked questions
What is the difference between MM and mm?
Uppercase MM is the month (01–12) and lowercase mm is minutes (00–59). Mixing them up is one of the most common date-format bugs. Similarly, HH is the 24-hour hour, while hh is the 12-hour hour and usually needs A or a for AM or PM.
How do I add literal text to a pattern?
Wrap it in square brackets. For example, [Today is] dddd prints the words without treating the d or a as tokens. Characters such as -, /, :, commas and spaces are not tokens and can be used without brackets.
What is the difference between Local and UTC?
Local formats the moment in your device’s time zone, and the Z and ZZ tokens show its offset, such as +02:00. UTC formats the same moment in Coordinated Universal Time, with an offset of +00:00. The instant is identical; only the clock time shown changes.
What does the W token show?
W is the ISO 8601 week number, from 1 to 53. ISO weeks start on Monday, and week 1 is the week that contains the year’s first Thursday, so the first days of January can belong to the last week of the previous year.
Which input formats are accepted?
Unix timestamps in seconds or milliseconds, detected automatically, and date strings your browser can parse, such as 2026-01-01T12:00:00Z. If the field is empty, the current time is used and updates every second. Invalid input shows an error message.
Is d the day of the month?
No. Lowercase d is the day of the week as a number, from 0 for Sunday to 6 for Saturday. Use D or DD for the day of the month and DDD for the day of the year.
Is my input uploaded?
Tools run in your browser. Files, text and results are not uploaded to our servers and are cleared when you leave the tool.
Your privacy comes first
Tools run in your browser. Files, text and results are not uploaded to our servers and are cleared when you leave the tool.