Intl.DateTimeFormat.prototype.format
Formats a date according to the locale and formatting options of this Intl.DateTimeFormat object
Syntax
dateTimeFormat.format(date?)Parameters
| Parameter | Type | Description |
|---|---|---|
| date | Date | number | The date to format (defaults to Date.now()) |
Return Value
A string containing the formatted date
Examples
const fmt = new Intl.DateTimeFormat('en-GB')
console.log(fmt.format(new Date(2026, 2, 7))) // '07/03/2026'const timeFormatter = new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
minute: '2-digit',
hour12: true
})
console.log(timeFormatter.format(new Date())) // e.g. '3:30 PM'function formatDate(date: Date, locale = 'en-US'): string {
return new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'short',
day: 'numeric'
}).format(date)
}Understanding Intl.DateTimeFormat.prototype.format
The Intl.DateTimeFormat.prototype.format method in JavaScript formats a date according to the locale and formatting options of this Intl.DateTimeFormat object. It belongs to the Intl.DateTimeFormat object and is one of the most widely used methods for working with intl.datetimeformat values in modern JavaScript and TypeScript applications.
The method signature is dateTimeFormat.format(date?). It accepts 1 parameter: date. When called, it returns a string containing the formatted date. Understanding when and how to use format() helps you write more expressive, readable code.
Common use cases for Intl.DateTimeFormat.prototype.format include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like intl-datetimeformat, intl-datetimeformat-formattoparts, intl-datetimeformat-formatrange, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Intl.DateTimeFormat.prototype.format is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Intl.DateTimeFormatCreates an Intl.DateTimeFormat object that enables language-sensitive date and time formatting
Intl.DateTimeFormat.prototype.formatToPartsFormats a date into an array of objects representing the formatted date in parts
Intl.DateTimeFormat.prototype.formatRangeFormats a date range in the most concise way based on the locale and options set on the DateTimeFormat object
More Intl.DateTimeFormat Methods
Other methods in the Intl.DateTimeFormat object
Related Tools
More Intl.DateTimeFormat Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.