日期类型
一个date对象是一个时间点的概念,就是对从一个固定起点时刻(1970-1-1日的0点0分0秒)到某个时刻所走过的毫秒数的封装;
方法:
var now=new Date();
格式化输出一个Date对象
var weekDay=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]
function moz(num) { return ( (num<10)? "0":"")+num; } function formatDate()
{ return ""+d.getFullYear()+ "-"+moz(d.getMonth())+ "-"+moz(d.getDate())+ " "+moz(d.getHours())+ ":"+moz(d.getMinutes())+ ":"+moz(d.getSeconds())+ " "+weekDay[d.getDay()]; }