Date & Time
Example : Fri May 21 2021 18:59:20 GMT+s0530 (India Standard Time)
todayDate will get the browser's time zone and display a date as a full text string.
Let's Break The Elements of Date
new Date() contains complete Date and Time including Time Zone
It Contains In This Order : Day , Month, Date, Year, Time , Time Zone
Creating Date Objects
new Date() is used to Create a New Date.
Once you have declared a Date Object it will be paused to that Time(It is a Static Date String). It Will Not Move According to the Clock.
ISO Follows "YYYY-MM-DD" Format Strictly, Other Than ISO All The Formats are Browser Dependent , If in your browser, you are using MM-DD-YYYY Format then it will take inputs in same format.
Get Date Methods
Get Date Method is used to Get the Current Date Object Date.
Here, It will Output your hour of the date in 24-Hour Format
Set Date Method
Set Date Method is used to set the date of the new date object.
Here, It will First Find the Difference Between 2022 year and current year and add 1 year to the current date.
You Can Directly Compare 2 Dates by Using if...else condition.
UTC Dates(Universal Time Zone Dates)
If you are Wondering about UTC Dates, Here are some Functions Which Gives date in UTC Format.