Format a date in JavaScript

javascript

Updated August 29, 2026

Use Intl.DateTimeFormat when the output is for people:

const date = new Date('2026-08-29T12:00:00Z');
const formatted = new Intl.DateTimeFormat('en-AU', {
  dateStyle: 'medium',
  timeZone: 'Australia/Melbourne'
}).format(date);
console.log(formatted);

A Date stores a timestamp; formatting is where you choose a locale and time zone. If you need a machine-readable value, use date.toISOString() rather than a locale string. Date-only strings such as 2026-08-29 are parsed as UTC by the standard, which can display as the previous day in a western time zone. Include a time zone or parse the input according to its documented format.

Check invalid input with Number.isNaN(date.getTime()). For recurring calendar rules, date arithmetic, or complex time zones, use a maintained date library or the modern Temporal API when it is available in your target runtimes.

Sources

related.

Ruslan Osipov

Ruslan Osipov

About the author