Local Time Zones And Locales


I was looking for a way to implement timezone in my application so I found a wiki Local time zones and locales

which it’s very interesting to implement, a few steps to follow and you’re done.

I had a little problem, when I try to convert to Local dates it won’t convert correctly.

I found out that the function getUTCNow() in LocalTime won’t return a valid value for the current time in UTC timezone.

In that case all the conversion attempts would fail (all based on correct UTC).

I found a way to get it works. I searched the forum and I found someone in another topic saying there’s an option in Yii config could be placed to determine the application timezone.



return array(


        'name'=>'My Web Application',


        // preloading 'log' component


        //setting application timezone


after setting timezone to UTC the conversion went correct, and my issue was solved.

I though of sharing this with you guys, might anyone is stuck in my place.