Re: Date problems
| From: | Rasmus Lerdorf | Date: | Sun, 09 Apr 2006 16:02:23 +0000 |
| Subject: | Re: Date problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233623@lists.php.net to get a copy of this message | ||
Satyam wrote:
Timestamps are stored as seconds from a certain date. The base date differ depending on the platform, Windows use 1/1/1980 the rest 1/1/1970, but still seconds. 7 days are 7*24*60*60. Just add that much to a timestamp. It helps having a constant such as: define ('DAY_IN_SECONDS',86400);The problem with doing it this way is that it won't take leap seconds, leap years and daylight savings into account, so on any of these edge cases it will appear to be broken. That's why strtotime("+7 days") is the correct way to do this. -Rasmus