码迷,mamicode.com
首页 > 其他好文 > 详细

判断早中晚的时间

时间:2019-11-25 20:42:54      阅读:53      评论:0      收藏:0      [点我收藏+]

标签:else   func   date   ons   cti   parse   log   this   fun   

  

  var that = this;

  /*小程序判断时间段的函数*/
  var time = parseInt(new Date().getHours()); //返回小时数
  if (7 < time && time < 11) {
    setTimeout(function () {
      console.log("这是早上")
    }, 1000)

  } else if (11 <= time && time < 17) {
    setTimeout(function () {
      console.log("这是中午")
    }, 1000)
  } else {
    setTimeout(function () {
      console.log("这是晚上")
    }, 1000)
  }

判断早中晚的时间

标签:else   func   date   ons   cti   parse   log   this   fun   

原文地址:https://www.cnblogs.com/shangjun6/p/11929906.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!