PHP translation of UNIX timestamp 1 hour off - Unable to find root cause

Hello,

I am hoping someone may be able to help me out with a strange issue that i cannot seem to resolve.

I have a server that is running CentOS 6.2 with Virtualmin as the control panel. It is running PHP v5.3.3.

I am haing an issue where PHP is apparently translating the UNIX timestamp as 1 hour earlier than the actual server time. (The server has the correct time and the date command does output the correct time and timezone.)

I am having issues with countdown timers and other items that rely on the date. This is causing errors… After confirming the server’s time is correct, I added the below line to my footer page in a site on the server and it gives me a timestamp of an hour earlier than the actual system time…

<!-- SERVER's UNIX TIMESTAMP: <?php echo time(); ?> -->

I only have two domains on this box so i then went in and edited the following files: (commented out all the date.timezone lines) to see if this was the issue…

/etc/php.ini /home/domain1/etc/php.ini /home/domain1/etc/php5/php.ini

/home/domain2/etc/php.ini /home/domain2/etc/php5/php.ini

Then restarted apache, and i am still getting the same thing… 1hour off… from the php output from above…

So, I am at a loss on what to do to correct this now. Any help here is really appreciated!

Thanks alot

first, see what timezone its using with http://us.php.net/manual/en/function.date-default-timezone-get.php, then you can change get to set to change the default timezone.

I have a problem with conversion of UNIX time in str and back. I have + 20:12 after conversion string into UNIX time and back. Please, help!!!
[php]

[/php]

Example:

Beginning-> August-15-2012 15:00
convert into unix time gives me -> 1345115520
Check - > August-16-2012 11:12 !Wrong!

Sponsor our Newsletter | Privacy Policy | Terms of Service