Page 1 of 2

Setting Server time

PostPosted: 29. November 2007 10:39
by picker
How do I set the Apache server time? Some time functions I am building are 8 hours out.

picker@guitarlesson.tv

PostPosted: 29. November 2007 11:42
by Wiedmann
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?

PostPosted: 01. December 2007 02:37
by picker
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.

PostPosted: 01. December 2007 21:22
by picker
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.

PostPosted: 01. December 2007 21:44
by Wiedmann
I am in MST

And that's 8 hours from UTC?

Maybe it helps to set the correct timezone in "php.ini"

PostPosted: 02. December 2007 01:28
by Izzy
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
===========================================

manila timezone not working...

PostPosted: 19. December 2007 03:34
by homer.favenir
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:

PostPosted: 19. December 2007 04:22
by Izzy
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
===========================================

PostPosted: 19. December 2007 04:37
by homer.favenir
thanks for the reply

C:\xampp\php\php.ini - location of php.ini ive edited

PostPosted: 19. December 2007 04:44
by Izzy
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
===========================================

PostPosted: 19. December 2007 04:52
by homer.favenir
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

PostPosted: 19. December 2007 04:57
by Izzy
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
===========================================

PostPosted: 19. December 2007 05:47
by homer.favenir
nothings change...do i have to restart the pc?
how do i know that it is already change?

PostPosted: 19. December 2007 06:07
by Izzy
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
===========================================

PostPosted: 19. December 2007 06:23
by homer.favenir
its now ok! my current time matches the time in myserver!
thanks a lot!
youre a big help...
salamat!
mabuhay!