时间戳 、yyyy-MM-dd 格式都可以通过 new Date()转换成中国标准时间: Tue Dec 31 00:00:00 GMT+0800 (中国标准时间)
new Date()的参数可以为空,也可以为以下几种:
1、new Date(“month dd,yyyy hh:mm:ss”);
2、new Date(“month dd,yyyy”);
3、new Date(yyyy,mth,dd,hh,mm,ss); 注意:这种方式下,必须传递整型;
4、new Date(yyyy,mth,dd);
5、new Date(ms); 注意:ms:是需要创建的时间和 GMT时间1970年1月1日之间相差的毫秒数;当前时间与GMT1970.1.1之间的毫秒数:var mills = new Date().getTime();
ps:因为月份是0-11(代表1-12月份),所以有时记得减去1 ,例如:new Date(,6,9),显示在日期选择器上就是-7-9,要想显示正确,就应该为 new Date(,6-1,9),也就是 new Date(,5,9),这样日期选择器上就是-6-9