ctrl+k
Enter a search term above to see results...
Enter a search term above to see results...
The Date utilities provide functions for formatting and manipulating dates in JavaScript.
Formats a date according to the specified format string and options.
International Support This function uses
Intl.DateTimeFormat
internally, please refer to the associated docs for details on timezone and formatting usage.
Local Timezone Usage When the ‘local’ keyword is used for the timezone option, the function will use the local timezone of the environment where the code is running. This is particularly useful for displaying dates in the user’s local time without needing to detect the timezone programmatically.
Name | Type | Default | Description |
---|---|---|---|
date | Date | The date to format | |
format | string | ’LLL’ | The format string (e.g., ‘YYYY-MM-DD’, ‘LT’, ‘LL’) |
options | object | Additional formatting options |
Name | Type | Default | Description |
---|---|---|---|
locale | string | ’default’ | The locale to use for formatting |
hour12 | boolean | true | Whether to use 12-hour time |
timezone | string | ’UTC’ | The timezone to use. Use ‘local’ for the local timezone. |
A formatted date string.