I need an 'is open now' php function on a site I am building. Looking at a previous question, I have built my mysql table:
hours_id INT NOT NULL,
loc_id INT NOT NULL,
dow TINYINT NOT NULL,
open_time TIME NOT NULL,
close_time TIME NOT NULL,
Then using:
"SELECT open_time, close_time
FROM opening_hours
WHERE dow=dayofweek(curdate())
AND loc_id=:loc_id"
I can then work out if it is open or not. The product I am building is global and I will need the 'open now' to be related to the timezone the location is in, not the server location or the viewers location.
I am already storing the country code and lat/lng of the location in a related db, so my thoughts are that I obtain the timezone from that, or provide a method for the user to select one, and then modify my SQL somehow.
Am I heading in the right direction? What would your method be?