note 54942 deleted from function.time by sean
| From: | sean@php.net | Date: | Wed, 31 Aug 2005 00:00:35 +0000 |
| Subject: | note 54942 deleted from function.time by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94468@lists.php.net to get a copy of this message | ||
Note Submitter: jt at imen dot org dot uk
----
Too many people are doing this in here and its BAD programming practice:
BAD:
<?
$timeinfuture = time() + 60 * 60;
?>
GOOD:
<?
$timeinfuture = strtotime("+1 hour");
?>
Reasoning:
Leap days / seconds etc. If you are doing things like +1 day, and a leap year comes around, then you
start doing things an hour out for six months of the year. Please see the strtotime function. (Ok ok
I will accept people doing things like time + 10 etc for very small movements but anything that is
60*60*anything is not right)