Jump to content


Date manipulation

  • Please log in to reply
1 reply to this topic

#1 dunksy

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 19 May 2006 - 03:44 PM

Good afternoon.

Right I am currently developing an availability and price checker for a hotel, and they want to be able to specify a price by date range. So they may enter a strt date, end date, and the price they wish to assign to all dates within that range.
Rather than store in a table a start date, end date and then price, i am thinking of storing one entry per day and store the price set. The reason being is that if they set the dates between June 1st 2006 and June 10th 2006 to price x, then go back, and set the dates between May 15th and June 15th there is going to be an overlap.

I therefore need to be able to take two dates and a price as input to my function, and the function would, for all dates occuring between these two, check the table to see if the entry is there for that specific date, and if not create one, if it is, then update it.

Sounds simple but I have still not got to grips with mktime() date() and the other date manipulation tools, and other tutorials do not seem to be helping me.

Any help would be greatly appreciated.



#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 19 May 2006 - 07:54 PM

So what's the structure of your table? How are you storing the dates?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users