Standard built-ins
Intl.DateTimeFormat
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
| Name | Type | Description |
|---|---|---|
| locales | String | Array | Requested locale tag or prioritized locale list. |
| options | Object | Formatting options. |
Return Value
Intl.DateTimeFormat
New formatter.
Working Example
Example Snippetjavascript
console.log(new Intl.DateTimeFormat("en-US",{timeZone:"UTC",year:"numeric"}).format(0));