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

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

高洛峰
高洛峰Original
2017-03-09 16:20:231489browse

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>


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!

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