China Naming Network - Naming consultation - How to display the current time (seconds and minutes) in js?

How to display the current time (seconds and minutes) in js?

& lt script & gt

Function show(){

var Date = new Date(); //Date object

var now =““;

now = date . getfullyear()+“year“; //Only read English.

Now = now+(date. getmonth()+ 1)+“month“; //Take the current month when taking the month-1. If you want to take the current month+1, you can do this.

now = now+date . getdate()+“day”;

now = now+date . get hours()+“when“;

Now = now+date. get minutes()+ "integral";

Now = now+date. get seconds()+ "seconds";

document . getelementbyid(“now div“)。 The html of innerHTML = now// now //div is a string.

setTimeout(“show()“, 1000); //Set 1000 ms to 1 sec and call the show method.

}

& lt/script & gt;

& ltbody onload =“show()“& gt; & lt! -Called once when the webpage is loaded, and then automatically called->

& ltdiv id =“now div“& gt; & lt/div & gt;

& lt/body & gt;

You can see the effect by copying directly.