|
Posted by Pedro Graca on 01/21/06 02:17
Notgiven wrote:
> Say you have two dates, 2005-01-01 and 2005-01-24. I want to get a list or
> array or all the date between and including those two dates.
>
> I want to include this list in a query so I need it in a format like:
> '2005-01-01', '2005-01-02',...
<?php
$d0 = gmmktime(0, 0, 0, 1, 1, 2005);
$d1 = gmmktime(0, 0, 0, 1, 24, 2005);
$day = 24*60*60;
$date_list = array();
for ($date_index = $d0; $date_index <= $d1; $date_index += $day) {
$date_list[] = gmdate('Y-m-d', $date_index);
}
print_r($date_list);
?>
--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Navigation:
[Reply to this message]
|