[JavaScript] a dynamic clock synchronized to the local time and custom time format, javascript time format
This article improves [JavaScript] The Dynamic Time synchronized to local time (click to open the link ).
In addition to toLocaleString (), the Date type in JavaScript can be converted into a system-formatted time.
You can also customize the time format. For example, you can construct a dynamic clock that is similar to the QQ chat box and synchronized to the local time.
The Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> The idea is exactly the same as [JavaScript] A Dynamic Time synchronized to the local time. The key is the setInterval function. At the same time, the reason why we need to add a condition structure of less than 10 is that, if we do not add it, for example, 19:01:01 will become, which is not in line with our habits.