JavaScript toDateString(): Convert a Date to Date Text

Date.prototype.toDateString() returns the date portion of a Date as a human-readable string interpreted in the local time zone. It omits the time and time-zone offset from the returned text.

Syntax:

date.toDateString();

Example:

const date = new Date(2026, 8, 10, 14, 30);
console.log(date.toDateString()); // Thu Sep 10 2026

What toDateString() Returns Top ↑

The method returns a string such as Thu Sep 10 2026. The exact date depends on the Date value after it is interpreted in the host’s local time zone.

const date = new Date("2026-09-10T20:00:00Z");
const text = date.toDateString();
console.log(text);
console.log(typeof text); // "string"

toDateString() vs toString() Top ↑

toString() includes both local date and local time information. toDateString() keeps only the date portion.

const date = new Date(2026, 8, 10, 14, 20, 30);
console.log(date.toDateString());
console.log(date.toString());

toDateString() vs toLocaleDateString() Top ↑

toLocaleDateString() is the better choice when the displayed date should follow a language, region, named time zone, or formatting options. toDateString() offers no locale/options arguments.

const date = new Date(2026, 8, 10);
console.log(date.toDateString());
console.log(date.toLocaleDateString("en-IN"));

Using String Methods After Conversion Top ↑

A Date object itself does not have String methods such as slice(). Apply them to the returned string.

const date = new Date();
const text = date.toDateString();
console.log(text.slice(4));

Local Time-Zone Behavior Top ↑

toDateString() uses the local time zone. The same timestamp may therefore display a different calendar date on computers in different zones.

When Not to Use toDateString() Top ↑

Do not use this human-readable output as a storage or interchange format. For a stable UTC machine-readable representation, use toISOString(). For user-facing localized output, use toLocaleDateString() or Intl.DateTimeFormat.

const date = new Date();
console.log(date.toISOString()); // stable UTC ISO 8601 string

Common toDateString() Mistakes Top ↑

  • Expecting locale-specific formatting options.
  • Assuming its output represents UTC.
  • Saving it as a machine-readable date format.
  • Calling String methods directly on the Date instead of on the returned string.

Next: toLocaleDateString() Date Reference




Subscribe to our YouTube Channel here



plus2net.com










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer