check time between 9.30 to 4 ruby

后端 未结 4 727
刺人心
刺人心 2020-12-31 11:41

i have a code that erroneously produces it and i am thinking that there must be a better way to check for time >9.30 am and time <4 pm any ideas is highly appreicated.<

4条回答
  •  鱼传尺愫
    2020-12-31 12:43

    Just:

    def checkTime
      return ((Time.now.hour * 60) + Time.now.min) >= 570 && ((Time.now.hour * 60) + Time.now.min) < 960
    end
    

提交回复
热议问题