Date对象
1 | new Date() |
打印结果为:Wed Mar 25 2015 16:37:03 GMT+0800 (CST)
1 | new Date("October 13, 2014 11:13:00"); |
打印结果为:Mon Oct 13 2014 11:13:00 GMT+0800 (CST)
1 | new Date(86400000) |
打印结果为:Fri Jan 02 1970 08:00:00 GMT+0800 (CST)
year, month, day, hour, minute, second, and millisecond1
Date(99,5,24,11,33,30,0);
打印结果为:Thu Jun 24 1999 11:33:30 GMT+0800 (CST)
Date方法
日期格式转换为string1
(new Date()).toString()
日期格式转为UTC string (date display standard).1
(new Date()).toUTCString()
日期格式转为可读的日期格式1
(new Date()).toDateString()
1970 年 1 月 1 日至今的毫秒数1
2
3(new Date()).getTime()
//nodejs中我经常这么写:
Date.now()
Date对象全部的属性方法:w3c