Intl.DateTimeFormat

Intl.DateTimeFormat.prototype.format

Formats a date according to the locale and formatting options of this Intl.DateTimeFormat object

Syntax

JavaScript
dateTimeFormat.format(date?)

Parameters

ParameterTypeDescription
dateDate | numberThe date to format (defaults to Date.now())

Return Value

A string containing the formatted date

Examples

Basic Usage
const fmt = new Intl.DateTimeFormat('en-GB')
console.log(fmt.format(new Date(2026, 2, 7))) // '07/03/2026'
Practical Example
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'
Advanced Usage
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

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.