<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>.html</title>
<style>
</style>
<script src= "Jquery-1.7.2.min.js" ></script>
<script>
GetDay () returns one day of the week (0-6)
GetDate () returns one day in one months (1-31)
When using the switch statement, the return has the function of stopping the function, so there is no need to add break;
function Tochinese (day) {
Switch (day) {
Case 0:return "Day";
Case 1:return "one";
Case 2:return "two";
Case 3:return "three";
Case 4:return "four";
Case 5:return "five";
Case 6:return "VI";
}
}
function GetTime () {
var odate=new Date ();
var str= "";
Str=odate.getfullyear () + "year" + (Odate.getmonth () +1) + "month" +odate.getdate () + "Day Week" +tochinese (Odate.getday ());
$ (". Time"). html (str);
}
</script>
<body>
<button class= "timebtn" onclick= "GetTime ()" > Beijing time </button>
<div class= "Time" ></div>
</body>
New Date () Time object