Date函数
1.月份
一月bai Jan. January
二月 Feb. February
三月 Mar. March
四月 Apr. April
五月 May. May
六月 Jun. June
七月 Jul. July
八月 Aug. August
九月 Sept. September
十月 Oct. October
十一月 Nov. November
十二月 Dec. December
- Date对象 – 时间 四种初始化日期格式
new Date();
new Date(value);
new Date(dateString);
new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]);
3.创建一个日期对象
var today = new Date()
var d1 = new Date("October 13, 1975 11:13:00")
var d2 = new Date(79,5,24)
var d3 = new Date(79,5,24,11,33,0)
console.log(today,d1,d2,d3)
4.getDate() 获取当前日期对象时几日
console.log(today.getDate())
console.log(d1.getDate())
console.log(d2.getDate())
console.log(d3.getDate())
5.getDay() 获取当前日期对象是星期几
console.log(today.getDay())
6.getMonth() 获取当前日期对象是几月 0 - 11
console.log(today.getMonth())//9 +1 =10
7.getFullYear() 获取当前日期对象的年份
console.log(today.getFullYear())
8.getTime()获取当前时间戳
console.log(today.getTime())
var myDate=new Date();
myDate.setFullYear(2010,0,14);
console.log(myDate)
9.Date函数.html:63 1603784702992,
myDate.setTime(1603784702992)
console.log(myDate)