Re: Most bizarre date problem ever

From: Date: Sun, 11 Apr 2004 01:55:27 +0000
Subject: Re: Most bizarre date problem ever
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-183102@lists.php.net to get a copy of this message
* Thus wrote Brian Dunning (brian@briandunning.com): > > $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? Works fine for me: $end_date = '2004-04-05'; $i = 1; $check_date = mktime(0, 0, 0, substr($end_date, 5, 2), substr($end_date, 8, 2) - $i, substr($end_date, 0, 4), -1); echo date('r', $check_date), "\n", $check_date; output: Sun, 4 Apr 2004 00:00:00 +0000 1081036800 Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#183102) next »