You are here: Re: generating a list of dates « PHP Programming Language « IT news, forums, messages
Re: generating a list of dates

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!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация