Welcome Guest, Not a member yet? Register   Sign In
Open or Closed. The great timestamp dilemma.
#1

[eluser]codelearn[/eluser]
Hey guys,

I'm working on building a script which will be able to tell you whether or not a restaraunt is open or closed depending on the time.

I've got a database which is storing the time the restaurant is open like so:

Quote:Field open_mon is the time the restaurant opens (opens at value of 500 would mean 5:00, 730 would mean 7:30, etc. Field close_mon is the same way. I have a open_mon_ap field which tells me if it opens in the AM or PM and the same for closing.

The question is, how do I use that information to see if the restaurant is currently open. The timezone conversion is pretty easy using CI's date helper... but I don't know how to get those open/close times into UNIX format.

Any ideas? Thanks!!
#2

[eluser]Bacteria Man[/eluser]
I would suggest storing the open/close times in seconds. For example 25200 is 7:00am and 75600 is 9:00pm.




Theme © iAndrew 2016 - Forum software by © MyBB