Date.prototype.toLocaleString
Formats a date together with the time by language rules.
Available since: ES1
Syntax
date.toLocaleString(locales, options)Parameters
| Parameter | Type | Description |
|---|---|---|
| locales | string | Optional. The language and region. |
| options | object | Optional. For example dateStyle, timeStyle, timeZone. |
Return value
stringThe date and time formatted by the language rules.
Examples
The date and time:
const date = new Date(2026, 2, 15, 18, 5);
console.log(date.toLocaleString('de-DE'));
console.log(date.toLocaleString('en-GB', { dateStyle: 'long', timeStyle: 'short' }));Output:
15.3.2026, 18:05:00
15 March 2026 at 18:05The same moment in another time zone:
const date = new Date('2026-03-15T12:00:00Z');
console.log(date.toLocaleString('en-GB', { timeZone: 'Asia/Tokyo' }));
console.log(date.toLocaleString('en-GB', { timeZone: 'America/New_York' }));Output:
15/03/2026, 21:00:00
15/03/2026, 08:00:00Notes
The timeZone option shows the moment in any time zone without changing the date. Numbers have their own toLocaleString() — for digit grouping and currencies.
See also
- Date.prototype.toLocaleDateString — Formats a date without time by language rules.
- Date.prototype.toLocaleTimeString — Formats a time without the date by language rules.
- Intl.DateTimeFormat — Formats dates and times by language rules.
Related recipes
In the tutorial
- Formatting with Intl — Locale-aware formatting of numbers, money, dates and plural words in JavaScript: toLocaleString, Intl.NumberFormat, Intl.DateTimeFormat and Intl.PluralRules.