note 47256 deleted from function.strtotime by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 10 Nov 2004 20:37:42 +0000 |
| Subject: | note 47256 deleted from function.strtotime by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80370@lists.php.net to get a copy of this message | ||
Note Submitter: jaisen (at) jmathai.com
----
Using '+1 month' can give unexpected results. For example, adding one month to January,
31st will give you March, 3rd. I never trusted this function anyways :)
<?php
$time = mktime(0,0,0,1,31,2005);
$newtime = strtotime('+1 month', $time);
echo 'One month after ' . date('m/d/Y', $time) . ' is ' .
date('m/d/Y', $newtime);
// One month after 01/31/2005 is 03/03/2005
?>