时间日期

// 时间日期:通过一个对象
// js提供了构造函数:Date
// var date = new Date() // 获取到当前时间对象
// console.log(date);

// // 对象可以获取具体的年月日、时分秒
// var year = date.getFullYear()
// console.log(year);

// var month = date.getMonth()+1
// console.log(month);

// var d = date.getDate()  //获取星期,0-6    0:星期天
// console.log(d);

// var day = date.getDay()
// console.log(day);

// var hour = date.getHours()
// console.log(hour);

// var minute = date.getMinutes()

// var second = date.getSeconds()
// console.log(minute,second);

// var milliSecond = date.getMilliseconds()
// console.log(milliSecond); // 1秒 == 1000毫秒

// // 世界标准时间:格林威志1970年1月1日0点0分0秒
// // 时间戳
// var time = date.getTime() // 中国标准时间的时间戳
// console.log(time);
posted @ 2021-01-08 09:30  技术活当赏  阅读(850)  评论(0)    收藏  举报