js时间显示设置

//对日期中部分小于10的数字前边添加0
function zero(s){
return s < 10 ? '0' + s: s;
} var date=new Date(),
year = date.getFullYear(),
month = date.getMonth()+1,
day = date.getDate(),
hour = date.getHours(),
minute = date.getMinutes(),
second = date.getSeconds();
var newTime=year+'年'+zero(month)+'月'+zero(day)+'日 '+zero(hour)+':'+zero(minute)+':'+zero(second);
上一篇:Android Weekly Notes Issue #285


下一篇:【二分答案】【POJ3122】【Northwestern Europe 2006】Pie