Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Create a reusable formatter const fmt = new Intl.DateTimeFormat("en-US", { year: "numeric", month: "long", day: "numeric", weekday: "long", }); const d = new Date("2024-06-15"); fmt.format(d); // "Saturday, June 15, 2024" // Time formatting new Intl.DateTimeFormat("en-US", { hour: "2-digit", minute: "2-digit", hour12: true, }).format(new Date()); // "10:30 AM" // Date ranges fmt.formatRange(new Date("2024-06-01"), new Date("2024-06-30")); // "June 1 – 30, 2024"
Result
Open