determine if a restaurant is open now (like yelp does) using database, php, js
Posted
by vee
on Stack Overflow
See other posts from Stack Overflow
or by vee
Published on 2010-06-18T14:09:34Z
Indexed on
2010/06/18
14:13 UTC
Read the original article
Hit count: 278
i was wondering if anyone knows how yelp determines what restaurants are "open now"? i'm developing a similar application using html/javascript/php. i was going to have a column in my database for each day, with comma separated hours written in "2243" format (10:43 pm). so for example if a restaurant is open for lunch and dinner it might be "1100,1400,1700,2200". then i'd check (using js) if the current time falls in one of the ranges for the current day. i'd also like to be able to determine if a restaurant is "open tonight", "open late", etc. for those i guess i'd check whether the open range overlaps with certain ranges.
is there a better way to do this? particularly, how to store the hours in the database and then determine if they overlap with a given set of hours.
thanks.
© Stack Overflow or respective owner