-4

Lets suppose start time= 2200 and end time= 0500. In PhP how can we check a given time is between start and end time? I only want to check the time, regardless of the date.

victor
  • 13
  • 2
  • 5
    without codes, we could just suggest use [`DateTime`](http://stackoverflow.com/questions/15911312/how-to-check-if-time-is-between-two-times-in-php) objects – Kevin Jan 28 '16 at 03:44

1 Answers1

2
if(date("Hi") >= 500 && date("Hi") <= 2200)

And since your minutes are 00 you can do

if(date("H") >= 5 && date("H") <= 22)
Hanky Panky
  • 46,730
  • 8
  • 72
  • 95