Copy Code code as follows:
<script language= "JavaScript" >
$ (document). Ready (function () {
Function Show () {
var mydate=new Date ();
var str = "" + mydate.getfullyear () + "year";
STR + + (Mydate.getmonth () + 1) + "month";
STR + + mydate.getdate () + "Day <br/>";
str = mydate.tolocaletimestring ();
STR + + ":" + mydate.tolocaletimestring ();
STR + + ":" + mydate.getmilliseconds () + "<br/> Week";
str + = "Day 123456". CharAt (Mydate.getday ()) + <br/> is this a leap year?: ";
str + = ((Mydate.getfullyear ()% 4 = 0 && mydate.getfullyear ()% 100!= 0) | | (Mydate.getfullyear ()% 400 = 0)) ? "Yes": "No"; };
function Flush () {
$ ("#btnShow"). Click (Show);
}
SetInterval (show,1000);
});
</script>
HTML code:
Copy Code code as follows:
<body>
<div>
<br/><br/><br/>
<button id= "Btnshow" > Show date Operations </button>
</br>
</div>
<div id= "DateTime" >
</div>
</body>
Results: