Home >Web Front-end >JS Tutorial >javascript time object tutorial
javascript time object tutorial
Time object is a built-in object of JS, which must be declared before use, including date and time.
The DATE object provides three methods:
1. Get the current time and date from the system;
2. Set the time and date at that time;
3. Convert time and date to other formats.
SetYear sets the current year
SetMonth sets the current month
setDate sets the current date
SetDay sets the week number of the current object
SetHours sets the current hour
setMinutes sets the current minute
setSeconds sets the current second
setTime sets the current time (in milliseconds)
The above is an example code, which displays the current system time. Directly copy the code and save it as Run HTML to see the effect.
The above is the content of the javascript time object tutorial. For more related articles, please pay attention to the PHP Chinese website (www .php.cn)!