> var myDate = new Date()
undefined
> myDate.getYear()
116
> myDate.getFullYear()
2016
> myDate.getMonth() // 0 - 11
7
> myDate.getDate() // 1 - 31
28
> myDate.getDay() // 0 - 6, 西方以周日为一周开始, 所以0是周日
0
> myDate.getTime() // 从1970.1.1开始的毫秒数
1472313859531
> myDate.getHours()
0
> myDate.getMinutes()
4
> myDate.getSeconds()
19
> myDate.getMilliseconds()
531
> myDate.toLocaleDateString()
'2016-08-28'
> myDate.toLocaleString()
'2016-08-28 00:04:19'
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment