function getNowDate(){
var d = new Date();
var vYear =
d.getFullYear();
var vMon = d.getMonth() + 1;
var vDay =
d.getDate();
var h = d.getHours();
var m = d.getMinutes();
var
se = d.getSeconds();
s=vYear+(vMon<10 ? "0" + vMon : vMon)+(vDay<10
? "0"+ vDay : vDay)+(h<10 ? "0"+ h : h)+(m<10 ? "0" + m : m)+(se<10 ?
"0" +se : se);
return s;
}
原文:http://www.cnblogs.com/afenge/p/3726068.html