Page 1 of 1

Wrong time zone

Posted: Thu Jan 01, 2004 10:15 pm
by gutter
Anybody have this problem? I'm on Redhat 7.3. My time zone is central - GMT-6. Here is the output of the date command:

[root@localhost root]# date
Thu Jan 1 22:13:11 GMT-6 2004

It shows the right timezone - GMT-6. However, PHP (in apache or on the command line) shows the timezone as GMT+6, but has the right date:

[root@versadb root]# cat test.php
<? echo date("r") ?>
[root@versadb root]# php -f /home/httpd/sites/live.versadb.com/hr/timesheet/test.php
Thu, 1 Jan 2004 22:13:15 +0600

This is causing the time to be off by 12 hours in some code (not written by me unfortunately) so I need to get it fixed.

Anyone have any ideas?

Posted: Thu Jan 01, 2004 10:48 pm
by devork
set the time zone
http://www.php.net/date
detail given on this link

Posted: Fri Jan 02, 2004 1:19 pm
by onefocus99
$datetime1 = date("U"); //timestamp
$datetime = date("l F d, Y - g:i:s a", ($datetime1+3600) ); //adds 1hr
click on search at this web site. It's already posted