Home >Web Front-end >HTML Tutorial >How to use js in html to get the local system time
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 IdentifyWhat is the difference between div and spanThe 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!