Date.toLocaleTimeString
toLocaleTimeString – Converts a Date object to a string.
Description
Date.toLocaleTimeString([mixed locales, [object options]])
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
locales | A string or array containing strings for the preferred locale format. | mixed | Yes | |
options | See options below. | object | Yes |
Options parameter
The options parameter may contain one or more of the following data items.
- localeMatcher
Possible values are: "best fit" (default) or "lookup".
- timeZone
The time zone to use.
- hour12
Possible values are: true or false. Default is set to the locale standard value.
- formatMatcher
Possible values are: "best fit" (default) or "basic".
- weekday
Possible values are "narrow", "short" or "long".
- era
Possible values are "narrow", "short" or "long".
- year
Possible values are "numeric" or "2-digit".
- month
Possible values are "numeric", "2-digit", "narrow", "short" or "long".
- day
Possible values are "numeric" or "2-digit".
- hour
Possible values are "numeric" or "2-digit".
- minute
Possible values are "numeric" or "2-digit".
- second
Possible values are "numeric" or "2-digit".
- timeZoneName
Possible values are "short" or "long".
Return values
string primitive.
Examples
Example #1 – toLocaleTimeString example
The returned value will be of the primitive string type.