formatDate

Converts a Date object into a string based on the specified format and locale.

For a runnable example, refer to the article on
date and number formatting and parsing.

Parameters

value Date

Defines the date that will be formatted.

format string | DateFormatOptions

Defines a string that represents a predefined or custom date format, or a configuration object.

locale? string

The optional locale id. If not specified, the id of the "en" locale is used.

Returns

string - The formatted date.