J
a
v
a
S
c
r
i
p
t
JavaScript
JavaScript的
D
a
t
e
Date
Date方法。
1.
D
a
t
e
Date
Date的一些方法介绍
var date = new Date();
console.log(date.getFullYear());
console.log(date.getMonth() + 1);
console.log(date.getDate());
console.log(date.getDay());
console.log(date.getHours());
console.log(date.getMinutes());
console.log(date.getSeconds());
2.获取从1970.1.1到现在的毫秒数 (时间戳)
var date = new Date();
console.log(date.getTime());
console.log(date.valueOf());
console.log(Date.now());
var tmp = +new Date();
console.log(tmp);