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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.