timezone math problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux