Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Intl.DateTimeFormat.prototype.formatToParts()

2 tags 1 category

The formatToParts() method of Intl.DateTimeFormat instances returns an array of objects representing each part of the formatted string that would be returned by format(). It is useful for building custom strings from the locale-specific tokens.

Return value: An Array of objects containing the formatted date in parts. Each object has two properties, type and value, each containing a string. The string concatenation of value, in the order provided, will result in the same string as format(). The type may be one of the date-time components:

Return value: weekday For example “M”, “Monday”, or “Montag”. era For example “BC” or “AD”. year For example “2012” or “96”. month For example “12” or “January”. day For example “17”. dayPeriod For example “AM”, “PM”, “in the morning”, or “noon”. hour For example “3” or “03”. minute For example “00”. second For example “07” or “42”. fractionalSecond For example “0”, “00”, or “000”. timeZoneName For example “UTC”, “CET”, or “Central European Time”.

Syntax example: formatToParts(date)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…