Time Stamp/Offset for XAMPP?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Time Stamp/Offset for XAMPP?

Postby Ruthless » 24. April 2007 00:43

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
Ruthless
 
Posts: 2
Joined: 24. April 2007 00:37

Postby maxnorris » 24. April 2007 01:08

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.
maxnorris
 
Posts: 17
Joined: 21. August 2006 06:51

Postby Wiedmann » 24. April 2007 01:19

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"
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Ruthless » 24. April 2007 02:00

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"
Ruthless
 
Posts: 2
Joined: 24. April 2007 00:37


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 143 guests