formatting

Date.prototype.toString

Returns a fixed English representation of the date in LOCAL time, e.g. 'Sun Jul 19 2026 05:30:00 GMT+0530 (India Standard Time)'. Called implicitly by template literals and string concatenation.

date.toString()

Parameters

Parameter Purpose
() no arguments; English + local zone
implicit used by `${date}` and String(date)
Invalid Date returns the literal string 'Invalid Date'

Examples

console.log(String(new Date('2026-07-19T00:00:00Z'))); // e.g. 'Sun Jul 19 2026 ...'

implicit conversion

console.log(new Date('bad').toString()); // 'Invalid Date'

no throw, string sentinel

console.log(`Now: ${new Date()}`); // uses toString

template literal

Gotcha

Format is engine-specified English and varies slightly between browsers - never parse it. For serialization use toISOString; for display use Intl.DateTimeFormat.

Related

← All JS Date methods · Math methods · Cron syntax