• 当前标签:日期对象

程序开发 JavaScript 日期对象

var t = new Date(2016,4,15,12) // 月份从0开始的 console.log(t.getTime()) // UTC根据世界时返回 1970 年 1 月 1 日 到指定时间的毫秒数 var t1 = new Date(9999,11,31,24,0,0) console.log(t1.getTime()) var now = new Date() console.log(now.getDate()) //某月中的某一天 console.log(now.getDay()) // 星期几 console.log(now.getMinutes()) //分钟 console.log(now.getSeconds()) //秒 console.log(now.getHours()) //时针 console.log(now.getFullYear()) console.log(now.getYear() + 1900) now.setMonth(5,16) now.setFullYear(1995) now.setHours(5) console.log(now)

2017-07-27 22:43:18 23 0 0
阅读详情
  • 1
前往