Wrong time zone

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gutter
Forum Newbie
Posts: 1
Joined: Thu Jan 01, 2004 10:15 pm

Wrong time zone

Post 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?
User avatar
devork
Forum Contributor
Posts: 213
Joined: Fri Aug 08, 2003 6:44 am
Location: p(h) developer's network

Post by devork »

set the time zone
http://www.php.net/date
detail given on this link
onefocus99
Forum Newbie
Posts: 16
Joined: Tue Oct 07, 2003 11:09 pm
Location: Hamilton Ont., Montreal, Chibougamau,... PQ, Victoria BC, now Alberta Canada

Post 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
Post Reply