Setting Server time

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

Setting Server time

Postby picker » 29. November 2007 10:39

How do I set the Apache server time? Some time functions I am building are 8 hours out.

picker@guitarlesson.tv
picker
 
Posts: 3
Joined: 07. February 2007 09:57

Postby Wiedmann » 29. November 2007 11:42

How do I set the Apache server time?

Apache is using your normal Windows system time.

Some time functions I am building are 8 hours out.

Maybe you are using this functions in a wrong way?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby picker » 01. December 2007 02:37

Hmmm. Its wierd cause the system time is correct. I have experienced the time issue with the Meeting Room Booking system wich is on sourceforge. I had to reschedule everybody because MRBS was 8 hours out as well.

I guess I might try changing my system time to 8 hours earlier to see if that makes a difference.
picker
 
Posts: 3
Joined: 07. February 2007 09:57

Postby picker » 01. December 2007 21:22

php

$time = date("Y-m-d h:i:s");
print($time);

I am in MST. My print out of $time reads 8 hours earlier.

My windows clock is set to MST.
picker
 
Posts: 3
Joined: 07. February 2007 09:57

Postby Wiedmann » 01. December 2007 21:44

I am in MST

And that's 8 hours from UTC?

Maybe it helps to set the correct timezone in "php.ini"
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Izzy » 02. December 2007 01:28

picker wrote:php

$time = date("Y-m-d h:i:s");
print($time);

I am in MST. My print out of $time reads 8 hours earlier.

My windows clock is set to MST.

Here is something that may be a little more helpful.

Solution 1 - Editing the php.ini file (recommended):

Find this section:
Code: Select all
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
;date.timezone =

Syntax is:
;date.timezone = "timezone_here"

Uncomment it and add your time zone in this format from the links below.
For example like so:
date.timezone = "America/New_York"

Time Zones are defined here and you would find the closest one to your location in the MST TZ:
http://us3.php.net/manual/en/timezones.php
http://us3.php.net/manual/en/timezones.america.php


Solution 2 - Editing the script/php file:

Just add this to to the top of your php script that calls the time.
For example like so:
Code: Select all
<?php
[b]date_default_timezone_set("America/New_York");[/b]
$time = date("Y-m-d h:i:s");
print($time);
?>



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

manila timezone not working...

Postby homer.favenir » 19. December 2007 03:34

im in manila philippines, my timezone is 'asia/manila', but my printout time is 4hours advance from my server. my problem is just like picker, however, ive already change php.ini, date.timezone="asia/manila" but nothing happens. what seems to be my error?

pls advice...
thanks
:roll:
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
homer.favenir
 
Posts: 16
Joined: 25. October 2007 20:10
Location: Manila, Philippines

Postby Izzy » 19. December 2007 04:22

Where was the location of the php.ini file you edited?

http://localhost/xampp/phpinfo.php
will tell you if you edited the correct file.



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby homer.favenir » 19. December 2007 04:37

thanks for the reply

C:\xampp\php\php.ini - location of php.ini ive edited
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
homer.favenir
 
Posts: 16
Joined: 25. October 2007 20:10
Location: Manila, Philippines

Postby Izzy » 19. December 2007 04:44

Incorrect!

Check for the correct file by using the link I provided in my last post - you did read it?


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby homer.favenir » 19. December 2007 04:52

i went to the address you gave and the phpinfo.php appears.
i saw Loaded Configuration File C:\xampp\apache\bin\php.ini
is this the correct file?

thanks
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
homer.favenir
 
Posts: 16
Joined: 25. October 2007 20:10
Location: Manila, Philippines

Postby Izzy » 19. December 2007 04:57

Correct!


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby homer.favenir » 19. December 2007 05:47

nothings change...do i have to restart the pc?
how do i know that it is already change?
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
homer.favenir
 
Posts: 16
Joined: 25. October 2007 20:10
Location: Manila, Philippines

Postby Izzy » 19. December 2007 06:07

nothings change...do i have to restart the pc?

Not the PC but you do have to restart the Apache server when ever you edit an .ini file or a .conf file to have you edits recognized.

Make sure you are typing the timezone in the correct case:
date.timezone = "Asia/Manila"
Not
date.timezone = "asia/manila"
(Apache is very strictly case sensitive).

how do i know that it is already change?

In the phpinfo.info file I mentioned above scroll down and look for the date module - they are in alphabetical order and your phpinfo file should look something like this:
Code: Select all
                              date

date/time support                              enabled
"Olson" Timezone Database Version              2007.5
Timezone Database                              internal
Default timezone                               Asia/Manila



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby homer.favenir » 19. December 2007 06:23

its now ok! my current time matches the time in myserver!
thanks a lot!
youre a big help...
salamat!
mabuhay!
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
homer.favenir
 
Posts: 16
Joined: 25. October 2007 20:10
Location: Manila, Philippines

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests