A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearTimezone in PHP - page 1
User InfoPosts
Timezone in PHP#1
PHP seems to use a rather annoying method for setting the evnironment timezone, using region names rather than the GMT offset. This makes having a timezone dropdown a huge pain, because it either has to be huge to accommodate all possible PHP timezone values, or I have to find a way to convert a GMT offset to a valid value to pass to PHP.

So, given a GMT offset, how might I set the timezone in PHP? For example, how might I convert the GMT offset value of "-8.0" to a value that I could pass to date_timezone_set()?

posted date: 2009-04-13 10:26:00

Re: Timezone in PHP#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-13 10:26:01

Re: Timezone in PHP#3
You will need to maintain a database with the daylight saving data of various locations, that(s why it is better to store a location.

posted date: 2009-04-13 10:33:00

Re: Timezone in PHP#4
How does PHP know the conversions (such as with DateTimeZone::getOffset) from one region to another if regional timekeeping conventions are always changing?

posted date: 2009-04-13 10:54:00

Re: Timezone in PHP#5
I imagine those come in PHP updates. You are keeping your PHP patched, right? :-)

posted date: 2009-04-13 10:55:00

Re: Timezone in PHP#6
If you are using PHP >= 5.2, you can use the built-in DateTimeZone class method, listAbbreviations.var_dump( DateTimeZone::listAbbreviations() );

posted date: 2009-04-13 11:39:00

Re: Timezone in PHP#7
Do they still release patches for PHP3? =P

posted date: 2009-04-15 00:45:00

Re: Timezone in PHP#8
I think this provides in-between PHP version updates to the timezone database pecl.php.net/package/timezonedb

posted date: 2012-11-04 20:43:00

Re: Timezone in PHP#9
You can also try to use PHP library Dater for working with datetime in different timezones and formats - https://github.com/barbushin/dater

posted date: 2013-12-27 04:40:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.