Date.prototype.toLocaleString() returns a locale-aware date-and-time string. By default it uses the environment’s locale and local time zone; you can supply a locale, a named time zone, and detailed formatting options.
Syntax:
date.toLocaleString();
date.toLocaleString(locales, options);
Example:
const date = new Date("2026-09-10T12:30:00Z");
console.log(date.toLocaleString("en-IN", { timeZone: "Asia/Kolkata" }));
With no arguments, the output is based on the runtime’s default locale and time zone, so punctuation, field order and hour cycle can differ between users.
const now = new Date();
console.log(now.toLocaleString());
const date = new Date("2026-09-10T12:30:00Z");
console.log(date.toLocaleString("en-IN"));
console.log(date.toLocaleString("en-US"));
console.log(date.toLocaleString("fr-FR"));
const options = {
weekday: "short",
year: "numeric",
month: "short",
day: "2-digit",
hour: "2-digit",
minute: "2-digit"
};
console.log(new Date().toLocaleString("en-IN", options));
For common user-facing formats, dateStyle and timeStyle are more concise than listing every component.
const date = new Date();
console.log(date.toLocaleString("en-IN", {
dateStyle: "long",
timeStyle: "short"
}));
const instant = new Date("2026-09-10T12:30:00Z");
console.log(instant.toLocaleString("en-IN", {
timeZone: "Asia/Kolkata",
dateStyle: "medium",
timeStyle: "long"
}));
Using a named zone is safer than manually adding fixed offsets when daylight-saving or historical offset rules may apply.
const date = new Date();
console.log(date.toLocaleString("en-IN", { hour: "2-digit", minute: "2-digit", hour12: false }));
When formatting many values with identical settings, reuse one formatter.
const formatter = new Intl.DateTimeFormat("en-IN", { dateStyle: "medium", timeStyle: "short" });
console.log(formatter.format(new Date()));
toDateString(): simple local date only.toLocaleDateString(): localized date only.toTimeString(): local time and zone information.toString(): general local date and time.toISOString(): stable UTC machine-readable output.Next: toDateString() Date Reference
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.