I’m working on a restaurant site and I have specific ordering hours. How do I compare a preset time-range with the current visitor’s time?
Also I need to set this preset time-range through a form.
Thanks
edit:
I tried to explode the date numbers multiply them and compare but I’m not sure how reliable it is. Other than this I can’t ask for the hours, I need to get them with javascript.
Also more exactly I need to let the client change the ordering hours in future.
edit 2: Can’t I just compare times in php, a preset time-range with the current time and ditch the JavaScript?
You can always manipulate [Unix]timestamps in PHP comfortably. Take a look at PHP’s
strtotime()function.You should be able to use it in a way that suits your current needs!