Results 1 to 6 of 6
Oct 27, 2007, 21:55 #1
How to do Calandering work in PHP?
I'm building a hotel reservation system for a client. I have a table called 'rooms' in the database, where there are records such as roomId = 5, roomType='Single'.
I need a system using which the client can set the availability of rooms during a certain period. For example, he should be able to set that during 1st November, 2007 - 1st December, 2007, all rooms of type 'single' are closed on saturdays and sundays, but available for the rest of the week during the entire month.
How can I code something like this? Questions:
1) Is there a way to get the 'day' on a particular date. E.g pass on a date such as 15th october, 2007 and have 'Sunday' as the return value.
2) How should I structure the database to store the availability schedule for something like this? I was thinking about inserting a record in a table for each day, (so about 30 records for during 1st november - 1st december), each record storing the roomId, the date, the day (e.g sunday, monday, etc) and the status (available, closed).
Does anyone have any better ideas? Please share!
Oct 27, 2007, 22:29 #2
1) Use date() but add the optional timestamp
Oct 27, 2007, 22:41 #3
Thanks for the answer galen. How can I build a timestamp out of a regular date?
Oct 27, 2007, 22:45 #4
date('format string', mktime());
would give you the day of the week for oct 15 2007
Oct 27, 2007, 23:08 #5
Gotcha, thanks pal! One last question if you don't mind, what do you think about the method I'm thinking about using for this issue (i.e question # 2) of my original post). Any comments about that?
Oct 28, 2007, 01:49 #6
- Join Date
- Aug 2006
- Lincoln, UK
- 0 Post(s)
- 0 Thread(s)
It would probably be easier to just store the dates that they are closed, rather than every date.