Detailed description of the Date object in JavaScript (making simple clocks) _ javascript skills

Source: Internet
Author: User
This article mainly introduces the Date object of JavaScript and shares with you how to make a simple clock. Interested friends can refer to the Date type provided by JS to process the time and Date. The Date type has a series of built-in methods for obtaining and setting Date and time information. Below we are simple
This topic describes the Date type.
Let's take a look at the Date method. The following is an example:

You can try the above method by yourself. I just want to briefly demonstrate the correct output format of JS:

Var today = new Date (); // create a time Date object document. write ("The following is the world standard time output:"); document. write (today +"
 "); Document. write (" The following is the local time output: "); document. write (today. toLocaleString () +"
 "); Document. write ("The following is the time output that matches the Chinese:"); document. write (today. getFullYear () + "-" + (today. getMonth () + 1) + "-" + today. getDate () + "" + today. getHours () + ":" + today. getMinutes () + ":" + today. getSeconds () +"
 ");

The output result is:

When I see this, I think of the local clock that comes with my computer. Click the time on the taskbar and a clock will pop up:

Now that we know the Date type in JS, can we display a clock of local time and Date on the webpage?
I simply made a simple clock.
Code:

   
  Simple watch creation based on integrated instances  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.