Home >Web Front-end >HTML Tutorial >Detailed explanation of using js in html to obtain local system time
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!