var time = new Date();
console.log(time.getTime())
// 返回毫秒时间
console.log(time.getFullYear())
// 返回四位数的年份
console.log(time.getMonth())
// 返回日期的月份
console.log(time.getDate())
// 返回日期月份的天数
console.log(time.getDay())
//返回日期的星期几
console.log(time.getHours())
//返回日期中的小时数
console.log(time.getMinutes())
//返回日期中的分钟数
console.log(time.getSeconds())
//返回日期中的秒数
console.log(time.getMilliseconds())
//返回日期中的毫秒数
console.log(time.setTime())
//设置毫秒时间
console.log(time.setFullYear())
//设置日期的年份
console.log(time.setMonth())
//设置日期的月份
console.log(time.setDate())
//设置日期月份中的天数
console.log(time.setHours())
//设置日期中的小时数
console.log(time.setMinutes())
//设置日期中的分钟数
console.log(time.setSeconds())
//设置日期中的秒数
console.log(time.setMilliseconds())
//返回日期中的毫秒数
console.log(time.setDay())
//不能设置星期几
时间与日期
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 将日期/时间格式转换为时间戳格式: 时间戳格式=(日期/时间格式-70*365-19)*86400-8*3600 ...