How to set time zone in codeigniter?

后端 未结 11 1727
醉话见心
醉话见心 2020-11-30 00:02

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

相关标签:
11条回答
  • 2020-11-30 00:04

    Add this line inside the main index.php of codeigniter folder

    date_default_timezone_set('Asia/Kolkata');
    
    0 讨论(0)
  • 2020-11-30 00:11

    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';
    
    0 讨论(0)
  • 2020-11-30 00:11

    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');
    }
    
    0 讨论(0)
  • 2020-11-30 00:12

    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');
    
    0 讨论(0)
  • 2020-11-30 00:12

    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';

    0 讨论(0)
  • 2020-11-30 00:14

    Add it to your project/index.php file, and it will work on all over your site.

    date_default_timezone_set('Asia/kabul');

    0 讨论(0)
提交回复
热议问题