Posted by Toby A Inkster on 01/29/07 06:34
laredotornado@zipmail.com wrote:
> Using PHP 4.4.4, I want to generate an array that contains strings
> representing days from Jan. 1, 2005 to whatever the current day is.
> So the array would contain the first values
<?php
$D = array(); // For results
$f = 'Y-m-d'; // Desired date format
$d = 1104537600; // 1 Jan 2005, Unix timestamp
while ($d < time()) // While still in the past...
{
$D[] = date($f,$d); // Add this date to the list
$d += 24*60*60; // The next date is 24 hours later
}
print_r($D); // Let's see what we've got!
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|