Re: Date ranges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mikey wrote:
> I have a page that is for booking attendance to events, and instead of
> using
> a date picker, I want to display drop-down selects which cover the ranges
> of
> dates that the event is occurring at. My question is, is there an easy way
> to determine the dates in between the date from and to that is stored in
> the
> database?  I know how to easily determine the number of days
>
> I know that if I spent time on it, I would be able to do it, but I have a
> very close deadline and if anyone else has been through this I would
> *really* appreciate the help...

Never done it, but here's a try:

$start = '1/24/2005';
$end = '2/14/2005';
list($m, $d, $y) = explode('/', $start);
$start_t = mktime(0, 0, 0, $m, $d, $y);
list($m, $d, $y) = explode('/', $end);
$end_t = mktime(0, 0, 0, $m, $d, $y);
for ($d1 = $d; mktime(0, 0, 0, $m, $d1, $y) <= $end_t; $d1++){
  echo date("m/d/Y", mktime(0, 0, 0, $m, $d1, $y)), "<BR />";
}

It's up to you to format the popups or whatever in the way that you want
them...

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux