I am working in a php project using codeigniter. Please advise me what is the global way to set time zone for php and mysql . In which file I can set this. I want to set it
Add this line inside the main index.php
of codeigniter folder
date_default_timezone_set('Asia/Kolkata');
If you are looking globabally setup timezone in whole project then you can setup it CI application/config.php
file
$config['time_reference'] = 'Asia/Dubai';
add it in your index.php file, and it will work on all over your site
if ( function_exists( 'date_default_timezone_set' ) ) {
date_default_timezone_set('Asia/Kolkata');
}
Add it to your project/application/config/config.php file, and it will work on all over your site.
date_default_timezone_set('Asia/Kolkata');
In the application/config folder, get the file config.php and check for the below:
$config['time_reference'] = '';
Change the value to your preferred time zone. For example to set time zone to Nairobi Kenya: $config['time_reference'] = 'Africa/Nairobi';
Add it to your project/index.php
file, and it will work on all over your site.
date_default_timezone_set('Asia/kabul');