Home > Web Front-end > HTML Tutorial > Detailed explanation of using js in html to obtain local system time

Detailed explanation of using js in html to obtain local system time

高洛峰
Release: 2017-03-09 16:20:23
Original
1528 people have browsed it

There are many ways to obtain the local system time. Next, I will introduce you to the specific implementation of using js to obtain it. If you are interested, you can refer to it.

The code is as follows:

<p id="名称"> 
<script language=Javascript> 
var now=new Date() 
document.write(1900+now.getYear()+"-"+(now.getMonth()+1)+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()) 
</script> 
</p>
Copy after login


Why use p? In order to choose the location to put it, for example, I put it in

The above is the detailed content of Detailed explanation of using js in html to obtain local system time. For more information, please follow other related articles on the PHP Chinese website!

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