"JavaScript" a dynamic clock synchronized to local time and custom time format

Source: Internet
Author: User
Tags local time

This article is an improvement on the "JavaScript"-a dynamic time in local time (click to open link)

In addition to being able to directly tolocalestring (), the date type in JavaScript translates into a system-formatted time

Time can also be customized format, such as can be constructed in an imitation QQ chat box synchronization in the local time of the dynamic clock


The specific code is as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">Thought and "JavaScript" a synchronization in the local time of the article (click Open link) exactly the same, the key is the SetInterval function, at the same time, the reason is to add a variety of less than 10 of the conditional structure, because, if not added, such as 19:01:01 will become 19 : 1:1 does not conform to our habits.

"JavaScript" a dynamic clock synchronized to local time and custom time format

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.