Home › All Tools ›

JS Date Formatter

Use JS Date Formatter online for free at FreeToolZones — no sign-up, no watermark.

Loading tool...

The JS Date Formatter on FreeToolZones takes a date and time and renders it in exactly the format you specify, using a pattern of tokens for year, month, day, weekday, hours, minutes, seconds, milliseconds, meridiem, timezone offset, and Unix timestamps. Dates are notoriously awkward to format by hand: months are zero-based in some systems, twelve-hour and twenty-four-hour clocks cause confusion, leading zeros are easy to forget, and every audience seems to want a different order. This tool removes that friction. You pick a date and time, type or choose a pattern, and the formatted result appears immediately, together with the ISO form and both Unix timestamp forms for reference.

Formatting matters because dates are read by people in many contexts: a report heading, a file name, a log line, a user interface label, a database value, or an API payload. Each context has its own convention, and getting the convention right is part of getting the work right. A formatter that shows you the result live, with presets for the common conventions and tokens for everything else, lets you produce the exact string you need without writing formatting code or consulting a reference table.

What Is the JS Date Formatter?

The JS Date Formatter is a free online tool that formats a chosen date and time according to a pattern you provide, in your local timezone. The date and time picker starts at the current moment, so the first thing you see is now, formatted with the default pattern. The pattern field starts with the pattern for year, month, day, hours, minutes, and seconds in twenty-four-hour form, producing strings like 2026-11-15 14:30:00. Changing the pattern and pressing Format, or choosing a preset, updates the result immediately. The tool runs on page load, so the display is populated before you touch anything, and choosing a preset both fills the pattern field and formats at once.

The pattern language uses tokens, each standing for one part of the date. Year tokens are YYYY for the four-digit year and YY for the last two digits. Month tokens are MMMM for the full name, MMM for the short name, MM for the two-digit number, and M for the number without a leading zero. Day tokens are DD for the two-digit day of month and D for the day without a leading zero. Weekday tokens are dddd for the full name and ddd for the short name. Hour tokens cover both clocks: HH and H for twenty-four-hour hours with and without a leading zero, hh and h for twelve-hour hours, with A and a for the meridiem in uppercase and lowercase. Minute tokens are mm and m, second tokens are ss and s, and SSS gives milliseconds with three digits. Timezone tokens are Z for the offset with a colon and ZZ for the compact offset without one. Timestamp tokens are X for Unix seconds and x for Unix milliseconds. Any other character in the pattern is copied literally, and literal text that could be mistaken for a token can be protected by wrapping it in square brackets, which are removed in the output while the enclosed text is kept verbatim.

Ten presets cover the conventions people reach for most often: the full date and time, the date alone, day-first and month-first numeric dates, the long written form with weekday and month name, the short written form with twelve-hour time, an ISO-like form without a timezone, the time alone, and the two Unix timestamp forms. The preset menu labels show example outputs, so you can pick by appearance rather than by remembering token spellings. The Use current time button resets the picker to now and formats immediately, which is useful when you need a timestamp for this moment.

The result display shows the formatted string large, followed by three reference values: the ISO 8601 form in UTC, the Unix timestamp in seconds, and the Unix timestamp in milliseconds. Those references are useful when you need more than one representation of the same moment, such as a human-readable label plus a machine timestamp for storage or comparison. A Copy button takes the formatted string to your clipboard. Dates are formatted in your local timezone, as the hint on the page states, and the timezone offset tokens reflect that local offset.

How to Use the JS Date Formatter

Formatting a date takes four steps.

  1. Choose a date and time. Use the Date and time picker, which starts at the current moment. Change any part of it to the moment you want to format. The hint reminds you that formatting uses your local timezone.
  2. Enter a pattern or choose a preset. Type a pattern in the Format pattern field, using the tokens listed in the hint below it, or pick a Preset from the menu. Choosing a preset fills the pattern field and formats immediately. Literal text that looks like a token goes in square brackets.
  3. Press Format. Click the Format button to apply the pattern. If the pattern is empty, the tool asks you to enter one. If the date and time are invalid, it asks you to choose a valid date and time. Otherwise the formatted result appears in the large display, with the ISO and timestamp references below.
  4. Copy the result. Press Copy to place the formatted string on your clipboard. Use the Use current time button whenever you need to reset the picker to now and reformat in one step.

When a pattern does not produce what you expected, check the token spellings first: tokens are case-sensitive, so MM means month while mm means minutes, and DD means day of month while ddd means weekday. A common mistake is using mm for the month, which produces the minutes instead. Another is forgetting that a literal word containing token letters, such as the word at followed by a time, needs brackets around any part that could be read as a token. Fix the pattern, press Format again, and compare the result with the preset examples to confirm the shape.

Key Features of the JS Date Formatter

The features below describe the picker, the pattern language, the presets, and the reference values.

Local timezone formatting with a live picker

The picker starts at now and formats in your local timezone, with offset tokens reflecting the local offset including daylight saving where applicable. The Use current time button refreshes the picker to the present moment and formats immediately, which is the fastest way to get a current timestamp in your chosen pattern.

A complete token set

Year, month in four forms, day of month, weekday in two forms, hours in both clocks, minutes, seconds, milliseconds, meridiem in both cases, timezone offset in two forms, and Unix timestamps in seconds and milliseconds cover every part of a date and time. Square bracket escaping protects literal text. The full token list is printed in the hint under the pattern field, so you never have to leave the page to look one up.

Ten presets for common conventions

The presets include the full timestamp, the date alone, day-first and month-first numeric forms, long and short written forms, an ISO-like form, the time alone, and both timestamp forms. Each preset label shows an example, so selection is by recognition. Choosing a preset updates the pattern field, so you can then edit the pattern to fine-tune it.

Reference values and copy

The ISO 8601 UTC form and both Unix timestamps accompany every result, giving you machine-friendly representations alongside the human-readable one. The Copy button takes the formatted string, and the large display makes the result easy to read and verify at a glance.

Practical Use Cases

Date formatting appears in reports, file names, logs, interfaces, and data exchange. The examples below show the range.

Writing human-readable headings and labels

A report heading, an email subject, or an interface label often needs a date in written form, such as Sunday, November 15, 2026, or a shorter form with a twelve-hour time. The long and short presets produce those forms directly, and the pattern can be adjusted for house style, such as dropping the weekday or changing the punctuation.

Creating sortable file and record names

File names and record identifiers sort correctly when dates use the year-month-day order with leading zeros. The default pattern and the date-alone preset produce exactly that order, and the ISO-like preset adds the time without a timezone for file names that must avoid colons and other special characters, though you may still need to replace the remaining colon characters depending on the file system.

Preparing timestamps for logs and data

Logs and data payloads often need a timestamp in a fixed form, sometimes as a formatted string and sometimes as a Unix number. The formatter gives you both: the pattern result for the string form, and the seconds and milliseconds references for the numeric forms. The SSS token adds milliseconds when log ordering needs finer resolution than seconds.

Converting between regional conventions

Day-first and month-first numeric dates are a perennial source of confusion, because 11/15/2026 and 15/11/2026 mean different things to different readers, and 03/04/2026 is genuinely ambiguous. The presets produce each convention explicitly, and the written forms remove the ambiguity entirely. When sharing dates across regions, prefer a written form or the ISO order.

Checking what a moment looks like in each form

When you are unsure how a particular moment will appear, or you need to confirm a timestamp value, formatting it here shows every representation at once. That check is useful before hard-coding a date in code, a document, or a configuration value, where a wrong assumption about timezone or format can cause a subtle bug.

Tips and Best Practices

  • Remember that tokens are case-sensitive. MM is month and mm is minutes, HH is twenty-four-hour and hh is twelve-hour, DD is day of month and ddd is weekday. A wrong case produces a wrong part, not an error, so verify the result.
  • Protect literal text with brackets. Words in a pattern that contain token letters can be misread. Wrap literal text in square brackets to keep it verbatim, and check that the brackets themselves do not appear in the output.
  • Prefer unambiguous forms for shared dates. Written month names and ISO order avoid the day-first versus month-first confusion. Reserve purely numeric forms for audiences that share one convention.
  • State the timezone when it matters. The Z and ZZ tokens include the local offset in the output, which removes doubt about which timezone a time belongs to. Use them in logs, data exchange, and cross-timezone communication.
  • Use the timestamp references for storage and comparison. Unix seconds and milliseconds are unambiguous and easy to compare. Keep the human-readable form for display, and the numeric form for computation.
  • Verify with a known date. Before relying on a new pattern, format a date you know well, such as today, and confirm every part appears as expected. That check catches token mistakes before they reach real data.

Limitations

The formatter works in your local timezone only. It cannot format a date in another timezone, convert between timezones, or account for a timezone other than the one your device is set to. The ISO-like preset produces a local time in ISO shape without a timezone designator, which is not the same as the UTC ISO form shown in the references, and the two should not be confused. The picker accepts dates and times at minute precision, so seconds and milliseconds in the result come from the picker value as interpreted, with seconds defaulting to zero unless the pattern and input imply otherwise, and the tool cannot accept a date before or after the range the browser picker supports.

The pattern language covers the listed tokens and literal text, and nothing else: it does not support ordinal suffixes, relative phrases, localized month names in other languages, or custom calendars. Month and weekday names are always in English. The tool formats one date at a time, so bulk conversion of many dates is better done with a script. Finally, the result is a string: it does not validate that the string is suitable for a particular system, such as a database or an API, and you should confirm the expected format with the receiving system.

Frequently Asked Questions

Why does my pattern show minutes where I expected the month?

Because tokens are case-sensitive: MM is the month and mm is minutes. Check the case of each token against the list in the hint, fix the pattern, and format again.

How do I include literal words in a pattern?

Wrap literal text in square brackets. The brackets are removed in the output and the enclosed text is kept verbatim, so it cannot be mistaken for tokens. Characters that are not token letters are copied literally without brackets.

What timezone does the formatter use?

Your local timezone, as set on your device. The hint on the page states this, and the Z and ZZ tokens show the local offset. The ISO reference value is the same moment in UTC, which may show a different clock time.

What is the difference between X and x?

X is the Unix timestamp in seconds since the epoch, and x is the same timestamp in milliseconds. The reference grid shows both, with separators, for every formatted date.

Can I format a date in another timezone?

Not with this tool. It formats in the local timezone only. For timezone conversion, use the Time Zone Converter on this site, then format the converted moment here if needed.

Is my date sent anywhere?

No. Formatting runs entirely in your browser, and nothing is sent to a server.

Related Tools

These tools convert, compare, and calculate with dates and times in the ways this formatter does not.

Browse More Tools