Working With the Date Type
Explore how JavaScript handles date and time using the Date reference type. Learn to create date objects with different constructors, understand UTC vs local time, and utilize numerous methods for getting and setting date parts.
We'll cover the following...
JavaScript specifies Boolean, Number, and String as primitive value types. Interestingly, it does not use a primitive value type for handling date and time values.
Instead,
The standard defines the date type (reference type) that stores dates as the number of milliseconds that have passed since midnight on January 1, 1970 UTC (Universal Time Code).
Leveraging this data storage format, the Date type can accurately represent dates almost 300,000 years before or after January 1, 1970.
Creating a date variable
To create a date, use the Date() constructor function, and pass the number representation as an argument. When the argument is omitted, the new object is assigned the current date and ...