(essay) JS gets the current time and the format of the current date date to get date days (November 27, 2014 16:31:49)

Source: Internet
Author: User


(essay) JS gets the current time and the format of the current date gets the date of day days Reference network (November 27, 2014 16:31:49 Zhejiang)


Formatting the current date gets date days
function Getnowformatdate (date) {
var day = new Date ();
var year = 0;
var Month = 0;
var day = 0;
var currentdate = "";
Initialization time
Year= day.getyear ();//have Firefox next 2008 years show 108 bug
Day.setdate (Day.getdate () + date);//Get Date days
Year = Day.getfullyear ();//IE Firefox can
Month = Day.getmonth () + 1;
Day = Day.getdate ();
Hour = Day.gethours ();
Minute = Day.getminutes ();
Second = Day.getseconds ();
CurrentDate + = year + "-";
if (Month >= 10) {
currentdate + = Month + "-";
} else {
currentdate + = "0" + Month + "-";
}
if (day >= 10) {
currentdate + = day;
} else {
currentdate + = "0" + day;
}
return currentdate;
}



This article is from the "Gentle Knife" blog, please be sure to keep this source http://wenrouyidao.blog.51cto.com/7368180/1583375

(essay) JS gets the current time and the format of the current date date to get date days (November 27, 2014 16:31:49)

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.