CodeIgniter Forums
Setting the timezone for codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Setting the timezone for codeigniter (/showthread.php?tid=37437)



Setting the timezone for codeigniter - El Forum - 01-10-2011

[eluser]vamsee[/eluser]
I got warning messages for not setting the date_default_timezone in php.ini.

But I took care of it by modifying the main index.php.

Instead if the codeigniter itself if take care of setting the environmental timezone then it would be better.

following is code added in main index.php

Code:
if( !ini_get('date.timezone') )
{
    date_default_timezone_set(date_default_timezone_get());
}



Setting the timezone for codeigniter - El Forum - 01-10-2011

[eluser]Unknown[/eluser]
Yeh, I've come upon this issue too in the past. I did a similar thing to you and were surprised that it's not a native config setting in codeigniter


Setting the timezone for codeigniter - El Forum - 01-11-2011

[eluser]Daniel Moore[/eluser]
CodeIgniter assumes you've got this set in your main PHP.INI file. Checking that item before actually setting it is definitely the way to go, in case you end up installing on a server at some point that has it set already.


Setting the timezone for codeigniter - El Forum - 01-15-2011

[eluser]InsiteFX[/eluser]
PHP 5.3 will complain with out the timezone setting just add it to index.php

InsiteFX