Date 日期

var time=new Date()
 console.log(time)
 //标准时间


 var day=time.getDate()
 console.log(day)
 //返回某月中的某一天


 var week=time.getDay()
 console.log(week)
 //返回某周中的某一天


 var year=time.getFullYear()
 console.log(year)
 //以4位数字返回年份


 var hours=time.getHours()
 console.log(hours)
 //返回对象中的小时


 var minutes=time.getMinutes()
 console.log(minutes)
 //返回分钟数


 var seconds=time.getSeconds()
 console.log(seconds)
 //返回秒数


 var haomiao=time.getTime()
 console.log(haomiao)
 //获取70年1月日到现在的毫秒数

案列1:时间

 

 案列2 :倒计时

 

posted @ 2018-12-21 10:22  杨晓蓉  阅读(179)  评论(0编辑  收藏  举报