Most bizarre date problem ever
| From: | Brian Dunning | Date: | Sat, 10 Apr 2004 15:11:28 +0000 |
| Subject: | Most bizarre date problem ever | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183071@lists.php.net to get a copy of this message | ||
Check this out: I'm returning a list of the last 30 days, looping through i, subtracting it from $end_date where $end_date is 2004-04-10 00:00:00. I'm just trying to derive a timestamp $check_date for each iteration, like 1081321200. Here's the code within the loop:
$check_date = mktime(0, 0, 0, substr($end_date, 5, 2), substr($end_date, 8, 2) - $i, substr($end_date, 0, 4), -1);
Note that this works PERFECTLY for every date, and always has. Except for one particular day. When $end_date - $i is supposed to be April 4, the timestamp returned is -7262, which it thinks is 12/31/1969. Can somebody PLEASE tell me how the above code manages to produce -7262, when it's always worked properly for every other day in history?
Confused,
- Brian