Basically what I need is an script that, when provided with a time and a timezone can return the time in another time zone.
My main issues are:
- Where to get the time offset from GMT from - is there a public database available for this?
- How to also take into consideration the daylight saving time (DST) differences as well.
- How to nicely wrap it all up inside an PHP class - or is there such a class already available?
I know its late. For anyone who would want simple function to convert utc to any local time zone
try this, it might help :)
Here i use this function for converting datetime into another timezone. For best result if you convert your datetime into utc timezone and then convert into required timezone then it is better result for it.
Thank You.
The above examples will output:
found on DateTime Manual on php.net
EDIT: Like Pekka said: The DateTime class exists from 5.2 on and there you first have to find out which of the methods are realy implemented and which one only exist from 5.3 on.