Standard built-ins

Intl.DateTimeFormat

Try the free JavaScript compiler

Locale-sensitive calendar and time display; specify timeZone to avoid implicit host zone.

Formal Syntax & Structure

javascript syntaxjavascript
new Intl.DateTimeFormat([locales], [options])

Parameters & Attributes

NameTypeDescription
localesString | ArrayRequested locale tag or prioritized locale list.
optionsObjectFormatting options.

Return Value

Intl.DateTimeFormat

New formatter.

Working Example

Example Snippetjavascript
console.log(new Intl.DateTimeFormat("en-US",{timeZone:"UTC",year:"numeric"}).format(0));
JavaScript Reference