Learning Goals
1. Learn how to create date objects
2. Mastering The method of getting DateTime in a Date object
3. Learn How to set the date time in the Date object
How to create a Date object
syntax:new Date ();
Function: Create a DateTime object
Return value: Returns the current DateTime object, in the case of a reference.
Description: If you want to create a Date object based on a specific date and time, you must pass in a date that represents that day:
The number of milliseconds or a comma-separated set of parameters that represent the day of the month and seconds.
How to get the day, minute and week of the month
1.getFullYear (): returns a 4 -digit year
2.getMonth (): Returns the month of the date with a return value of 0-11
3.getDate (): returns the number of days in the month
4.getDay (): return week, return value is 0-6
5.getHours (): return hour
6.getMinutes (): return points
7.getSeconds (): return seconds
8.getTime (): Returns the number of milliseconds that represent the date
The method of setting the day of the month and the week
1.setFullYear (): returns a 4 -digit year
2.setMonth (): Returns the month of the date, starting at 0 ,0 for 1 months
3.setDate (): Set Date
4.4.setDay (): return week, starting from 0 ,0 for Sunday
5.setHours (): return hour
6.setMinutes (): return points
7.setSeconds (): return seconds
8.setTime (): sets the date in milliseconds and changes the entire date
Built-in objects in JavaScript -8-date objects-4