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.

<?php
date_default_timezone_set
('Asia/Kolkata');
?>

6 Comments

  1. Kumar Said...
  2. Deepak Said...
  3. Rohan Gour Said...
  4. Madheshwaran Said...
  5. Naveen Chaudhari Said...
  6. Amit Shee Said...

Leave a reply

keyboard_double_arrow_up