Standard built-ins

Intl.DateTimeFormat.prototype.format()

Try the free JavaScript compiler

Bound function that formats a date or timestamp. Omitted argument uses current time; supply a fixed instant for deterministic results.

Formal Syntax & Structure

javascript syntaxjavascript
formatter.format([date])

Parameters & Attributes

NameTypeDescription
dateDate | NumberInstant to format.

Return Value

String

Localized date/time text.

Working Example

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