The Date object has many of methods for getting and setting the date and/or the time; we'll focus on a few of the most useful methods.
Dates and times are a bit tricky to work with on the computer.
Earlier, you learned how to create a unique key for your to-do items in Local Storage using the Date object and the get Time() method, which returns the current date and time represented as the number of milliseconds since 1970.
It's time we return to the Date object, and its methods, and explore the power of this object further.
I'm in the Pacific time zone in the United States, so my time is currently 7 hours behind the GMT (Greenwich Mean Time) measured from Greenwich, in London, England.We have one Date object for the date in 2020, and one Date object for now.Then, we can use the get Time() method to get the date and time in milliseconds since 1970.Modify as shown: Using the Date constructor, you can specify the year, month, day, hour, minutes, seconds, and milliseconds all together to create a date and time.But what if you need to set the various values separately?