Example 1 — Basic toDateString() Output
Format a fixed local date (month index is zero-based) as a readable string.
const event = new Date(1993, 6, 28); // Jul 28, 1993 (local)
console.log(event.toDateString()); // "Wed Jul 28 1993" How It Works
- Build a local date.
new Date(1993, 6, 28)is July 28, 1993 (month index6). - Format the date portion.
toDateString()returns weekday + month + day + year. - No time in the result. Hours and minutes are omitted on purpose.
- No side effects. The
Dateis unchanged; the method only returns a string.

