Formats a date and/or time using custom formatting logic based on dateStyle and timeStyle.
dateStyle
timeStyle
Uses explicit Intl.DateTimeFormat options for full control over the output format.
Intl.DateTimeFormat
"short"
dd/mm/yyyy
11:59 PM
formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "short", timeStyle: "short"}); // "31/12/2025, 11:59 PM"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "medium", timeStyle: "medium"}); // "Dec 31, 2025, 11:59:59 PM"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "long", timeStyle: "long"}); // "December 31, 2025, 11:59:59 PM EST"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "full", timeStyle: "full"}); // "Wednesday, December 31, 2025, 11:59 PM Eastern Standard Time"formatDateTime(new Date("2025-12-31T23:59:59"), { timeStyle: "short"}); // "11:59 PM" Copy
formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "short", timeStyle: "short"}); // "31/12/2025, 11:59 PM"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "medium", timeStyle: "medium"}); // "Dec 31, 2025, 11:59:59 PM"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "long", timeStyle: "long"}); // "December 31, 2025, 11:59:59 PM EST"formatDateTime(new Date("2025-12-31T23:59:59"), { dateStyle: "full", timeStyle: "full"}); // "Wednesday, December 31, 2025, 11:59 PM Eastern Standard Time"formatDateTime(new Date("2025-12-31T23:59:59"), { timeStyle: "short"}); // "11:59 PM"
Optional
The Date object or timestamp to format.
Date
Formatting options.
A string representing the formatted date and/or time.
Formats a date and/or time using custom formatting logic based on
dateStyleandtimeStyle.Uses explicit
Intl.DateTimeFormatoptions for full control over the output format."short"date is alwaysdd/mm/yyyy"short"time is always 12-hour format (e.g.,11:59 PM)Example Output