js6-获取兄弟/父节点 获取类名/文档元素 九宫格思想 日期对

2017-11-12  本文已影响0人  前端雨

获取兄弟节点

获取文档子元素

九宫格思想

获取日期对象-11

//1.获取日期对象
var myDate = new Date();

//2.Date()  返回当日的日期和时间
console.log(Date());  //Sun Nov 12 2017 16:16:45 GMT+0800 (中国标准时间)

//3.getDate()   从 Date 对象返回一个月中的某一天 (1 ~ 31)。
console.log(myDate.getDate());

//4.getDay()    从 Date 对象返回一周中的某一天 (0 ~ 6)。 0 周日, 6 周六
console.log(myDate.getDay());

//5.getMonth()  从 Date 对象返回月份 (0 ~ 11)。
console.log(myDate.getMonth() + 1);

//6.getFullYear()   从 Date 对象以四位数字返回年份
console.log(myDate.getFullYear());

//7.getHours()  返回 Date 对象的小时 (0 ~ 23)。
console.log(myDate.getHours());

//8.getMinutes()    返回 Date 对象的分钟 (0 ~ 59)。
console.log(myDate.getMinutes());

//9.getSeconds()    返回 Date 对象的秒数 (0 ~ 59)。
console.log(myDate.getSeconds());

//10.getMilliseconds()  返回 Date 对象的毫秒(0 ~ 999)。
console.log(myDate.getMilliseconds());

//11.getTime()  返回 1970 年 1 月 1 日至今的毫秒数。
// 时间戳
console.log(myDate.getTime());

JS对象

JSON

上一篇 下一篇

猜你喜欢

热点阅读