deno.com

method Intl.DateTimeFormat.format

#DateTimeFormat.format(date?: Formattable | number): string

Format a date into a string according to the locale and formatting options of this Intl.DateTimeFormat object.

Examples #

#
const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'full' });
const date = new Date(2023, 0, 1);
console.log(formatter.format(date)); // Output: "Sunday, January 1, 2023"

Parameters #

#date: Formattable | number
optional

Return Type #

string