JS学习笔记-Date
- 基本使用
var now = new Date(); // Sat May 01 2021 21:39:33 GMT+0800 (中国标准时间)
now.getFullYear();
now.getMonth();
now.getDate();
now.getDay();
now.getHours();
now.getMinutes();
now.getSeconds();
now.getTime(); // 时间戳 全世界统一 1970-01-01 00:00:00 至今的毫秒数
console.log(new Date(1619876373487)); // 时间戳转为时间
- 转换
now = new Date(1619876373487);
now.toLocaleString(); // 注意:这是一个方法,不是一个属性
2432

被折叠的 条评论
为什么被折叠?



