JavaScript · More dates

date.toLocaleString()

Formats both date and time for a locale.

Syntax
date.toLocaleString(locale)

Example

Try it

More in this group

date.getDate() date.getDay() date.getHours() date.getMinutes() date.getMonth() date.getTime() Date.parse() date.setDate()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course