<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<body>
<div id= "Div1" >
</div>
<script type= "Text/javascript" >
Window.onload=function Show () {
var date=new date ();
var fullyuar=date.getfullyear ();//year
var month=date.getmonth () +1; Month
var mydate=date.getdate (); Day
var h=date.gethours (); When
var m=date.getminutes (); Score of
var s=date.getseconds (); Seconds
var day=date.getday (); Day of the Week
var days=checkday (day);
var ms=checktime (m);
var sb=checktime (s);
document.getElementById ("Div1"). Innerhtml= (fullyuar+ "year" +month+ "month" +mydate+ "Day" +days+ " " +h+ ":" +ms+ ":" +SB);
var time=settimeout (show,1000);
}
function Checktime (i) {
if (i<10) {
I= "0" + i;
}
return i;
}
function Checkday (i) {
switch (i) {
Case 0:i= "Sunday";
Case 1:i= "Monday";
Case 2:i= "Tuesday";
Case 3:i= "Wednesday";
Case 4:i= "Thursday";
Case 5:i= "Friday";
Case 6:i= "Saturday";
}
return i;
}
</script>
</body>
JS Date Display Effect