Home > Web Front-end > JS Tutorial > javascript time object tutorial

javascript time object tutorial

黄舟
Release: 2016-12-15 10:39:17
Original
1407 people have browsed it

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.





Show current time - www.web2bar.cn





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)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template