strtotime would be a neater way of solving the problem... ie (untested): $n = 0; while ($n <= 9) { $date = "d".$n; $$date = date("Y-m-d", strtotime("+ $n days") $n++; } If you are just enquiring about the maths though, I'm not sure! -----Original Message----- From: Korgan [mailto:josberger@xxxxxxxxx] Sent: 15 September 2009 16:32 To: php-general@xxxxxxxxxxxxx Subject: Problem with date Hi, I have a problem with date function. $gen_pos = mktime(0,0,1,10,25,2009); $d1 = date("Y-m-d", $gen_pos); // 2009-10-25 $d2 = date("Y-m-d", $gen_pos + (1*24*60*60)); // 2009-10-25 $d3 = date("Y-m-d", $gen_pos + (2*24*60*60)); // 2009-10-26 $d4 = date("Y-m-d", $gen_pos + (3*24*60*60)); // 2009-10-27 $d5 = date("Y-m-d", $gen_pos + (4*24*60*60)); $d6 = date("Y-m-d", $gen_pos + (5*24*60*60)); $d7 = date("Y-m-d", $gen_pos + (6*24*60*60)); $d8 = date("Y-m-d", $gen_pos + (7*24*60*60)); line 2 and line 3 return same date,its wrong ... it should be 2009-10-25 , 2009-10-26 ? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php