Home >Web Front-end >JS Tutorial >JS method to realize dynamic display of date and time_javascript skills

JS method to realize dynamic display of date and time_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:27:211247browse

The example in this article describes the method of dynamic display of date and time in JS. Share it with everyone for your reference, the details are as follows:

The screenshot of the running effect is as follows:

The specific code is as follows:

<html>
<head>
<title>js日期时间动态显示</title>
</head>
<body>
  <div id='jnkc'></div>
  <script>setInterval("jnkc.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
  </script>
</body>
</html>

I hope this article will be helpful to everyone in JavaScript programming.

Statement:
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