formatDateTime

The

formatDateTime
function is used to format dates given a provided format pattern.

It uses small-date

under the hood.

Do's & Don'ts

Don't use it if you can use the DateTime component.

Params

Name
Type
Default
Description
date
string, Date
Date.now()
The date that is being formatted
format
string
dd MMMM yyyy
The format pattern
options
object

Options

Name
Type
Default
Description
locale
sv-SE
sv-SE
The locale used to format
timeZone
Europe/Stockholm
Europe/Stockholm
The time zone from which the date is related

Returns

string
: Formatted date

Examples