datetime - How to compare two time in PHP -


I have the format twice, such as stored in variables 7:30:00 and 22:30:00 $ Resttimeframe and $ resttimeto respectively.

I have to see if the present time is between these two values ​​or not. I'm checking this with

  $ time = date ("G: i: s"); If ($ time> $ resttimefrom and $ time <$ resttimeto) {$ stat = "open"; } And {$ stat = "off"; }  

But I'm always getting $ stat in close form. What could be the reason for this?

There is a simple and clever way to do this: 'From:': Your dates

$ resttimefrom = 73000; $ Rest tiemato = 223000; $ Current date = (date of) date ('GIS'); If ($ current time & gt; $ rest time & amp; $ current time & lt; $ resttimeto) {$ stat = "open"; } And {$ stat = "off"; }

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -