前几日使用到Javascript的Date初始化一个日期
var dt = new Date(2005,8,31)
结果发现dt.getDate()为1
仔细查了一下Javascript参考才发现,原来如此
Versions prior to JavaScript 1.3:
new Date()
new Date(milliseconds)
new Date(dateString)
new Date(yr_num, mo_num, day_num[, hr_num, min_num, sec_num])
Parameters
|
milliseconds
|
Integer value representing the number of milliseconds since 1 January 1970 00:00:00.
|
|
dateString
|
String value representing a date. The string should be in a format recognized by the Date.parse method.
|
yr_num, mo_num, day_num
|
Integer values representing part of a date. As an integer value, the month is represented by 0 to 11 with 0=January and 11=December.
|
hr_num, min_num, sec_num, ms_num
|
Integer values representing part of a date.
|
相关文章:
-
2022-12-23
-
2021-12-07
-
2021-10-11
-
2021-07-08
-
2021-09-16
-
2021-05-27