Is there something else going on here that I don't understand? I even posted a test page with this:
Code: Select all
<?php
echo date('l, F j :: h:i A');
?>Moderator: General Moderators
Code: Select all
<?php
echo date('l, F j :: h:i A');
?>Code: Select all
$timestamp = time(); //or $time_stamp_from_database
echo date('l, F j :: h:i A', $timestamp+2*60*60);Not all places do DST.d11wtq wrote:The server's zoneinfo database is probably wrong.
Code: Select all
<?php
if ( !defined('DATE_RFC850') ) {
defined('DATE_RFC850', 'l, d-M-y H:i:s T');
}
echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname('srm'), "<br />\n";
echo 'time: ', time(), "<br />\n";
echo 'date: ', date(DATE_RFC850), "<br />\n";
echo 'gmdate: ', date(DATE_RFC850), "<br />\n";
echo 'ENV[TZ]: ', isset($_ENV['TZ']) ? $_ENV['TZ'] : 'n/a', "<br />\n";
echo 'date.timezone: ', get_cfg_var('date.timezone'), "<br />\n";
echo 'default tz: ', function_exists('date_default_timezone_get') ? date_default_timezone_get() : 'n/a', "<br />\n";
echo 'locatime-file: ', exec('ls -lad /etc/localtime'), "<br />\n";
echo 'system date: ', exec('date'), "<br />\n";should be US/Pacific which is currently Pacific Daylight Time (PDT)Location: Rancho Cucamonga, Calif. USA
Code: Select all
<?php
echo date('l, F j :: h:i A T');
?>Code: Select all
<?php
echo date('l, F j :: h:i A I');
?>Code: Select all
if (!defined('DATE_RFC850')) {
defined('DATE_RFC850', 'l, d-M-y H:i:s T');
}
echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname('srm'), "<br />\n";
echo 'time: ', time(), "<br />\n";
echo 'date: ', date(DATE_RFC850), "<br />\n";
echo 'gmdate: ', date(DATE_RFC850), "<br />\n";
echo 'ENV[TZ]: ', isset($_ENV['TZ']) ? $_ENV['TZ'] : 'n/a', "<br />\n";
echo 'date.timezone: ', get_cfg_var('date.timezone'), "<br />\n";
echo 'default tz: ', function_exists('date_default_timezone_get') ? date_default_timezone_get() : 'n/a', "<br />\n";
echo 'locatime-file: ', exec('ls -lad /etc/localtime'), "<br />\n";
echo 'system date: ', exec('date'), "<br />\n";
echo'<br />';
echo date('l, F j :: h:i A T');
echo'<br />';
echo date('l, F j :: h:i A I');Panama Jack's code:Warning: Wrong parameter count for defined() in /home/XXXX/public_html/timetest.php on line 23
version: 4.4.1
uname: FreeBSD
time: 1174066518
date: FriAMPSTE_RMarchC850
gmdate: FriAMPSTE_RMarchC850
ENV[TZ]: n/a
date.timezone:
default tz: n/a
locatime-file: -r--r--r-- 1 root wheel 2819 Mar 12 09:31 /etc/localtime
system date: Fri Mar 16 09:35:18 PST 2007
Code: Select all
<?php
echo date('l, F j :: h:i A T');
?>
<?php
echo date('l, F j :: h:i A I');
?>Based on these results, I see that the server is set to PST and is not honoring the shift to DST. The system time shown in the results above also shows PST, but does have the correct time. Apparently, the hosting company merely moved the server time ahead by one hour without making the proper adjustment for DST.Friday, March 16 :: 09:35 AM PST
Friday, March 16 :: 09:35 AM 0
Code: Select all
if (!defined('DATE_RFC850')) {
define('DATE_RFC850', 'l, d-M-y H:i:s T');
[...]
echo 'gmdate: ', gmdate(DATE_RFC850), "<br />\n";If it was 9:35 am that day then yes, they just shifted the clock.charp wrote:Produced this:Based on these results, I see that the server is set to PST and is not honoring the shift to DST. The system time shown in the results above also shows PST, but does have the correct time. Apparently, the hosting company merely moved the server time ahead by one hour without making the proper adjustment for DST.Friday, March 16 :: 09:35 AM PST
Friday, March 16 :: 09:35 AM 0
Code: Select all
date_default_timezone_set('US/Pacific');
echo date(DATE_RFC850, 1174066518);(sorry, date_default_timezone_set is not available for php 4.4.1)Friday, 16-Mar-07 10:35:18 PDT
what a pitty, not a symbolic linklocatime-file: -r--r--r-- 1 root wheel 2819 Mar 12 09:31 /etc/localtime
Code: Select all
echo "start<br >\n";
system('zdump -v /etc/localtime | grep 2007'), "<br />\n";
echo "end<br >\n";Code: Select all
zdump -v /usr/share/zoneinfo/US/Pacific | grep 2007
/usr/share/zoneinfo/US/Pacific Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0
/usr/share/zoneinfo/US/Pacific Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1
/usr/share/zoneinfo/US/Pacific Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1
/usr/share/zoneinfo/US/Pacific Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005 wrote:The bill amends the Uniform Time Act of 1966 by changing the start and end dates of daylight saving time from 2007. Clocks were set ahead one hour on the second Sunday of March (March 11, 2007) instead of the first Sunday of April (April 1, 2007).
Using the code for the zdump:version: 4.4.1
uname: FreeBSD
time: 1174086926
date: Friday, 16-Mar-07 15:15:26 PST
gmdate: Friday, 16-Mar-07 23:15:26 GMT
ENV[TZ]: n/a
date.timezone:
default tz: n/a
locatime-file: -r--r--r-- 1 root wheel 2819 Mar 12 09:31 /etc/localtime
system date: Fri Mar 16 15:15:26 PST 2007
Looking at the output on the first bit, I realize that the system time was also off. The first time around, I thought I saw it as the correct time, but it's 1 hour off as well. So, now I'm really confused about why the tech guys think the server is on the correct time.start
/etc/localtime Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800 /etc/localtime Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800 end
Code: Select all
putenv('TZ=PST8PDT');Code: Select all
<?php
echo date('l, F j :: h:i A');
echo'<br />';
putenv('TZ=PST8PDT');
echo date("Y-m-d h:i:sa", time());
echo'<br />';
echo date('l, F j :: h:i A');
echo'<br />';
echo'<br />';
if (!defined('DATE_RFC850')) {
define('DATE_RFC850', 'l, d-M-y H:i:s T');
}
echo 'version: ', phpversion(), "<br />\n";
echo 'uname: ', php_uname('srm'), "<br />\n";
echo 'time: ', time(), "<br />\n";
echo 'date: ', date(DATE_RFC850), "<br />\n";
echo 'gmdate: ', gmdate(DATE_RFC850), "<br />\n";
echo 'ENV[TZ]: ', isset($_ENV['TZ']) ? $_ENV['TZ'] : 'n/a', "<br />\n";
echo 'date.timezone: ', get_cfg_var('date.timezone'), "<br />\n";
echo 'default tz: ', function_exists('date_default_timezone_get') ? date_default_timezone_get() : 'n/a', "<br />\n";
echo 'locatime-file: ', exec('ls -lad /etc/localtime'), "<br />\n";
echo 'system date: ', exec('date'), "<br />\n";
echo'<br />';
echo'<br />';
echo date('l, F j :: h:i A T');
echo'<br />';
echo'<br />';
echo date('l, F j :: h:i A I');
echo'<br />';
echo'<br />';
echo "start<br >\n";
system('zdump -v /etc/localtime | grep 2007'). "<br />\n";
echo "end<br >\n";
?>Code: Select all
Thursday, March 22 :: 02:12 PM
2007-03-22 03:12:27pm
Thursday, March 22 :: 03:12 PM
version: 4.4.1
uname: FreeBSD
time: 1174601547
date: Thursday, 22-Mar-07 15:12:27 PDT
gmdate: Thursday, 22-Mar-07 22:12:27 GMT
ENV[TZ]: n/a
date.timezone:
default tz: n/a
locatime-file: -r--r--r-- 1 root wheel 837 Mar 22 13:43 /etc/localtime
system date: Thu Mar 22 15:12:27 PDT 2007
Thursday, March 22 :: 03:12 PM PDT
Thursday, March 22 :: 03:12 PM 1
start
/etc/localtime Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800 /etc/localtime Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200 /etc/localtime Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800 endCode: Select all
echo "<pre>start\n";
system('zdump -v /etc/localtime | grep 2007'). "<br />\n";
echo "\nend</pre>\n";It's the new zoneinfo.start
/etc/localtime Sun Mar 11 09:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 PST isdst=0 gmtoff=-28800
/etc/localtime Sun Mar 11 10:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 08:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 PDT isdst=1 gmtoff=-25200
/etc/localtime Sun Nov 4 09:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 PST isdst=0 gmtoff=-28800
end