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

php中世界最好的语言
Release: 2018-02-10 09:08:27
Original
2624 people have browsed it

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>
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!