timezone math problem.

From: Date: Thu, 16 Sep 2010 14:51:16 +0000
Subject: timezone math problem.
Groups: php.general 
Request: Send a blank email to php-general+get-308125@lists.php.net to get a copy of this message
I have the following: #!/usr/local/bin/php <?php $offset = date("Z"); $sDate = '2010-09-16'; $sTime = '00:00:00'; $eDate = '2010-09-17'; $eTime = '00:00:00'; $tmpStart0 = date("$sDate $sTime"); $tmpEnd0 = date("$eDate $eTime"); $startDate = date("Y-m-d H:i:s",strtotime($tmpStart0 . "-" . "$offset seconds")); $endDate = date("Y-m-d H:i:s",strtotime($tmpEnd0 . "-" . "$offset seconds")); $when = "timestamp BETWEEN \"$startDate\" AND \"$endDate\""; echo "\n$offset\n$when\n\n"; ?> Which returns: machine1 (AST) PHP 5.2.6: -10800 timestamp BETWEEN "2010-09-16 03:00:00" AND "2010-09-17 03:00:00" machine2 (MST) PHP 5.1.6: -21600 timestamp BETWEEN "1969-12-31 17:00:00" AND "1969-12-31 17:00:00" Aside from upgrading the second box, is there some other logic that is wrong? Thanks. -- Paul Halliday Ideation | Individualization | Learner | Achiever | Analytical http://www.pintumbler.org

« previous php.general (#308125) next »