(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)