bhylu.com

Advertisements

JS Date Methods

Use Date for timestamps and Intl.DateTimeFormat for display. Set a time zone when the output should not depend on the machine.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const day = new Date("2026-11-07T10:00:00Z");
const formatter = new Intl.DateTimeFormat("en-GB", {timeZone: "UTC", year: "numeric", month: "long", day: "numeric"});
console.log(formatter.format(day));

What happens

The label reads 7 November 2026.