problem with setting to local time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

problem with setting to local time

Post by susrisha »

Hi i am using php 5.2.6 supported for apache 2.2.8

My problem is to get the localtime displayed on a particular script. The local time of my place is 5 1/2 hrs more than the GMT. By default the system shows the GMT. I have tried it two ways.. First thing to set the php.ini file as below:

Code: Select all

 
date.timezone = Asia/Kolkata
 
I saved the php.ini file and restarted the apache server. Still no use.. it still shows GMT

Next thing i changed in the code...

Code: Select all

 
date_default_timezone_set('Asia/Kolkata');
$time= date("Y.m.d H:i:s P");
 
OUTPUT for the code is

Code: Select all

 
2008.08.13 06:43:08 +00:00
 
can someone help me offset the time by default??
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: problem with setting to local time

Post by susrisha »

figured it out somehow.. i didnt have php_dbtimezone.dll file. got it from internet.
And then Asia/kolkata is not existing..Hence i changed the timezone to Asial/Calcutta.
Working very smooth
Post Reply