Zest.

JavaScript: Format a date

A short, tested JavaScript example for format a date. Copy it and adjust the names and paths for your project.

JavaScript
const d = new Date();

d.toISOString();                                   // "2026-10-12T10:30:00.000Z"
d.toLocaleDateString("en-GB", { dateStyle: "long" }); // "12 October 2026"
new Intl.DateTimeFormat("de-DE", { dateStyle: "medium", timeStyle: "short" }).format(d);

Find it in Zest

Search for “javascript format a date” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More JavaScript examples

All JavaScript examples