New Date () Time object

Source: Internet
Author: User

<! 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.