JavaScript|JavaScript(第三章第1课)(内部对象--(Date))

标准对象

typeof 123 'number' typeof '123' 'string' typeof true 'boolean' typeof NaN 'number' typeof [] 'object' typeof {} 'object' typeof Math.abs 'function' typeof undefined 'undefined'

Date基本使用
var now =new Date(); now.getFullYear(); //年 now.getMonth(); //月 now.getDate(); //日 now.getDay(); //星期 now.getHours(); //时 now.getMinutes(); //分 now.getSeconds(); //秒 now.getMilliseconds(); now.getTime(); //时间戳

结果演示 now.getFullYear(); 2022 now.getMonth(); 4 now.getDate(); 6 now.getDay(); 5 now.getHours(); 14 now.getMinutes(); 49 now.getSeconds(); 13 now.getMilliseconds(); 624 now.getTime(); 1651819753624

转换
now =new Date(1651819753624) Fri May 06 2022 14:49:13 GMT+0800 (中国标准时间)now.toLocaleString(); '2022/5/6 14:49:13'now.toGMTString(); 'Fri, 06 May 2022 06:49:13 GMT'

    推荐阅读