Jump to content

odd date function behaviour on 4th nov 2007


mouli

Recommended Posts

Hi

I am using a very simple date function to add a number of days to a starting date. Sounds so simple and it is but this function works for any date except 4th november 2007..

The function and a sample useage is as follows:

function addDays ($days, $fmt="Y-m-d", $date=NULL) {
// Adds days to date or from now  // By JM, www.Timehole.com
   if ($date==NULL) { $t1 = time(); }
   else{$t1 = strtotime($date);
   $t2 = $days * 86400; // make days to seconds
return date($fmt,($t2+$t1));}
}
$newdate =  addDays(1,'Y-m-d','2007-11-5');

echo $newdate;

 

and it works great for any date use but try adding one day to 2007-11-04 and i get 2007-11-04!

 

Its the only date that I can find that doesn't work and I cant figure out why.

 

I'm sure its a simple answer but its got me very puzzled.

 

Have a go and tell me what you get.

 

Many thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.