Page 1 of 1

get and set timezones

Posted: Thu Aug 25, 2005 7:31 pm
by raghavan20
I am looking to get the current time zone and change it to EUROPE, if possible UK GMT.
I tried date_default_timezone_get() but the command does not seem to be recognized.
Anybody know the code like UTC for UK time setting using date_default_timezone_set()???

Posted: Thu Aug 25, 2005 7:50 pm
by Stewsburntmonkey
There are actually GMT variants of the core date functions:

gmdate()
gmmktime()
gmstrftime()


You can use the setlocale() function to change the time zone if you need to. :)

Posted: Thu Aug 25, 2005 7:52 pm
by feyd
both of those functions are in 5.1.0

date('Z'); will tell you what time zone you are in (on the server)

gmdate() will generate a GMT based time.

Posted: Thu Aug 25, 2005 7:59 pm
by raghavan20
feyd, date('Z') returns 10800. wots the meaning of that???
Is it possible to tell an application or a file to use a particular zone say for example GMT as standard?
When we use NOW() in Mysql it uses local server time, if I want that in a different timezone how do I do that???

Posted: Thu Aug 25, 2005 8:06 pm
by feyd

Code: Select all

Z	Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.	-43200 through 43200
I personally always store timestamps in integer form in databases. However, this may help you find what you need to change.. although you could simply perform the necessary calculations in your queries..