Prototype Conversion Getters

Conversion methods turn a date into a number or a string. toISOString() and toJSON() give the UTC ISO 8601 form used by JSON.stringify(); toString(), toDateString() and toTimeString() give fixed English local formats; toLocaleString(), toLocaleDateString() and toLocaleTimeString() format through Intl.DateTimeFormat, taking a locale and options such as dateStyle and timeZone.

Converting one Date to numbers and stringsJavaScriptLive
const d = new Date(2026, 6, 16, 9, 5);                 // 16 Jul 2026, 09:05 in GMT+8
console.log(d.valueOf(), d.toISOString(), JSON.stringify({ d }));
console.log(d.toUTCString(), '|', d.toDateString(), '|', d.toTimeString());
console.log(d.toLocaleString('zh-CN'), '|', d.toLocaleDateString('de-DE'));
console.log(d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }));
console.log(d.toLocaleString('en-US', { timeZone: 'America/New_York', dateStyle: 'full',
  timeStyle: 'short' }));

JSON.parse() does not revive dates: pass the ISO string back to new Date(). When formatting many dates, create one Intl.DateTimeFormat and reuse its format() method rather than calling toLocaleString() in a loop.