How to know if today's date is in a date range?

前端 未结 8 1718
死守一世寂寞
死守一世寂寞 2020-12-12 10:14

I have an event with start_time and end_time and want to check if the event is \"in progress\". That would be to check if today\'s date is in the r

8条回答
  •  悲&欢浪女
    2020-12-12 10:51

    Checked is current date in between two dates. Using Ruby

    currentDate = DateTime.now
    start_date = "2017-03-31"
    end_date = "2018-03-31"
    currentDate.between?(start_date, end_date)
    
    **Out Put Will be** true or false
    

提交回复
热议问题