Home >Web Front-end >HTML Tutorial >How to use js in html to get the local system time

How to use js in html to get the local system time

php中世界最好的语言
php中世界最好的语言Original
2018-02-10 09:08:272688browse

This time I will show you how to use js in html to get the local system time. What are the things to note when using js in html to get the local system time? The following is a practical case. Let’s take a look. . The code is as follows:

<div 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> 
</div>

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

What are the symbols that mark text comments in Html?


How to pass the escape characters of html through the code Identify


What is the difference between div and span

The above is the detailed content of How to use js in html to get the 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