php.ini

Status
Not open for further replies.

sollerti

New Member
Messages
26
Reaction score
0
Points
0
Hello,

I am trying to change the timezone in my php script. Currently when I use the date() function I get back a CDT time, while I would like to get a different time zone (e.g. EDT).

I looked around and found that a possible way would be to create a php.ini file and to set the following parameter to US/Eastern
date.timezone = "US/Eastern"

I have tried this, but it does not seem to work.
php.ini file is currently in my public_html folder...

Any ideas?

Thank you!
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
There is just one php.ini per server and that is set by the administrator.

You will have to adjust your script.

$myDate = date( $formatString , time() + 3600 ) ;
 

sollerti

New Member
Messages
26
Reaction score
0
Points
0
OK...I can try that, thanks!

Nevertheless, it might still be a problem since I am actually trying to use European Central Time, and the Daylight savings time changes differently in the US as it does in Europe...

Any ideas?

From what I read on the web, the php.ini file can also be set locally (but does not seem to work for me):
http://kb.siteground.com/article/How_to_change_the_datetimezone_value_in_PHP.html
If your PHP scripts do not show the correct time, the reason is that most probably your hosting server is in a different timezone. This can be easily resolved by changing a setting in PHP called date.timezone.

Depending on your location you can set a specific date.timezone value in PHP using the following option which should be added to your local php.ini file:

date.timezone = "US/Central"

The above example assumes you'd like to set the timezone for your PHP scripts to US/Central. The full list of supported time zones is available here and you should simply replace "US/Central" with the desired timezone.


Any thoughts?
 

sollerti

New Member
Messages
26
Reaction score
0
Points
0
OK, I found a work around

date_default_timezone_set('America/Los_Angeles');

Thanks for your help.

This thread can be closed now
 
Status
Not open for further replies.
Top