How to change the timezone in CodeIgniter

When your CodeIgniter project is hosted on shared server, you haven’t able to modify the php.ini file. But many times you needs to modify the server settings for your project. The commonly required changes are timezone setting. We’ll show you the simplest way to change the timezone in CodeIgniter project.

PHP date_default_timezone_set() function is used to sets the default timezone used by all date or time functions. In CodeIgniter, the best place to set the timezone is index.php file of application root.

Place the date_default_timezone_set() with your desired timezone in the main index.php file of your application.


Leave a reply