Page 1 of 1

Time Stamp/Offset for XAMPP?

PostPosted: 24. April 2007 00:43
by Ruthless
I've installed XAMPP on both Windows 2003 Server and Mac OS X. On both systems the time is 1 hour ahead (when running a simple PHP script or posting data to MySQL) of the server time (US/Arizona). I've looked through some docs and searched the forums without any luck.

Any information on fixing this issue would be great, thanks!

Walter

PostPosted: 24. April 2007 01:08
by maxnorris
The PHP getdate function should be reading your system clock directly.

Here's a quickie way to see exactly what PHP is showing as the time and date, unmodified. Make a blank file, say time.php and paste this into it:

Code: Select all
<?php
$today = getdate();
print_r($today);
?>


And see what you get back. (It'll be an exploded array, in 24 hour format) It should match your system's clock. (Daylight savings is handled by Windows so it'll be accurate regardless. If using Linux, it might come back in Universal Time)

Some PHP scripts need to be given a hint though. (Good example is a forum. They typicall have a time offset somewhere) Does the PHP code have an offset somewhere that may need an adjustment? (IE, setting it to 0) If the above code is reporting back the right time (which it should, assuming your system clock is accurate) its the PHP code.

PostPosted: 24. April 2007 01:19
by Wiedmann
What timezone is your PHP using? (PHP, not your System!)

Maybe you should set the correct timezone in "php.ini":
Code: Select all
date.timezone = "America/Phoenix"

PostPosted: 24. April 2007 02:00
by Ruthless
Thank you -- that did the job. I had looked over the php.ini file figuring that was it, but when I didn't see a timezone line by default I wasn't sure.

Thanks again!

Walter

Wiedmann wrote:What timezone is your PHP using? (PHP, not your System!)

Maybe you should set the correct timezone in "php.ini":
Code: Select all
date.timezone = "America/Phoenix"