[PHP-DB] Re: Final Date Question :-)

2003-02-19 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Chris Payne) writes:
 pardon les francais :-)

Les Français - the (pl) french (people) ? ;-)

 I don't know how else to explain it so sorry if I confused you.

I don't know if anybody else might get this, but I have absolutely no
idea what you mean. If I'm to say anything, I think you have to post
some code.


-- 
--Fredrik
Faith, n:
That quality which enables us to believe what we know to be
untrue.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: Final Date Question :-)

2003-02-19 Thread Chris Payne
Hi there :-)

Basically what I mean is I have an orderform for rooms.  THey can select the
date they arrive and the date they leave, but if they leave on a different
month when the price is higher, the last day or however many will be a
higher price, what I need is to not only calculate the flat price, but also
take into account if their stay goes over a period of time when rooms are
more than they are at other times of the year.
So, they could book monday - friday, monday thru wednesday could be $50, but
it needs to check and see if any of the dates - in this example - fall on a
date that the prices are higher, so in this example thursday and friday
would be $80 a night whereas monday thru wednesday would be $50.  It's hard
to explain :-)

Chris

 [EMAIL PROTECTED] (Chris Payne) writes:
  pardon les francais :-)

 Les Français - the (pl) french (people) ? ;-)

  I don't know how else to explain it so sorry if I confused you.

 I don't know if anybody else might get this, but I have absolutely no
 idea what you mean. If I'm to say anything, I think you have to post
 some code.


 --
 --Fredrik
 Faith, n:
 That quality which enables us to believe what we know to be
 untrue.

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Re: Final Date Question :-)

2003-02-19 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Chris Payne) writes:
 Basically what I mean is I have an orderform for rooms.  THey can select the
 date they arrive and the date they leave, but if they leave on a different
 month when the price is higher, the last day or however many will be a
 higher price, what I need is to not only calculate the flat price, but also
 take into account if their stay goes over a period of time when rooms are
 more than they are at other times of the year.
 So, they could book monday - friday, monday thru wednesday could be $50, but
 it needs to check and see if any of the dates - in this example - fall on a
 date that the prices are higher, so in this example thursday and friday
 would be $80 a night whereas monday thru wednesday would be $50.  It's hard
 to explain :-)

OK. I guess you have to check all the dates, then. You could do it by
starting with the first day, get the timestamp for that day
(mktime(0,0,0,m,d,y)), and then you can add 86400 (secs per day) to
this and check each day consecutively using e.g. the getdate()
function. (http://www.php.net/manual/en/function.getdate.php)

Something like (not tested):

// ...
$current_timestamp = mktime(0,0,0,$start_m,$start_d,$start_y);
// ...
for($i=0;$i$num_days_of_stay;$i++){
  $this_date = getdate($current_timestamp);
  // $this_date now contains all the info you need
  // Now, check for month, day of week etc. and update as needed
  // ...
  $current_timestamp += 86400;
}


-- 
--Fredrik
Faith, n:
That quality which enables us to believe what we know to be
untrue.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php