Hi

I have been using mktime() to determine the next 12 months for a program, and i have discovered what seems a bug in the function.

The following code...

<?php
for($i=0;$i < 12;$i++){

$currentDate = date("d m Y",mktime(0, 0, 0,date("m")+$i , date("d"), date("Y")));
$currentDateArray = explode(" ",$currentDate);
$currentMonth = $currentDateArray[1];
$currentYear = $currentDateArray[2];
echo "$i : $currentMonth : $currentYear <br>";
}


.... gives the following output:


$i : Month: Year 0 : 08 : 2004 1 : 10 : 2004 2 : 10 : 2004 3 : 12 : 2004 4 : 12 : 2004 5 : 01 : 2005 6 : 03 : 2005 7 : 03 : 2005 8 : 05 : 2005 9 : 05 : 2005 10 : 07 : 2005 11 : 07 : 2005

This output has a problem.

Does anyone have any suggestions on what other functions I could use other than mktime to build dates ???

Cheers

John Clegg

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



Reply via email to