PHP Check if time is between two times regardless of date

前端 未结 5 1135
挽巷
挽巷 2020-12-03 06:26

I\'m writing a script were I have to check if a time range is between two times, regardless of the date.

For example, I have this two dates:

$from          


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 06:50

    Try this:

    function checkTime($From, $Till, $input) {
        if ($input > $From && $input < $Till) {
            return True;
        } else {
            return false;
    }
    

提交回复
热议问题