JavaScript · Dates and internationalisation

Date arithmetic

Dates compare and add through millisecond timestamps. Mutating methods such as setDate exist too.

Syntax
date.getTime() + ms

Example

Try it

More in this group

date.getFullYear() Date.now() date.toISOString() date.toLocaleDateString() Intl.DateTimeFormat new Date()

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