日期函数结果错误的时间在CodeIgniter和date_default_timezone_set('Asia / Singapore'); 在配置文件中不起作用

Like the title, i have problem with date(Y-m-d H:i:s); function with give wrong time. I have changed config.php file with add date_default_timezone_set('Asia/Singapore'); on top of the file and it is not fully working.

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
date_default_timezone_set('Asia/Singapore');

However it working if i add it at the method/function that use date function as example :

function giveMyDate(){ 
date_default_timezone_set('Asia/Singapore'); 
echo(date('Y-m-d H:i:s')); 
}

Can anyone explain why if i add date_default_timezone_set in config.php not working? I must add it as global cause too much code that use date function.

The case above similar to here but i already try that suggestion but not working : CodeIgniter date - wrong time

have you tried changing timezone in your php.ini ?

[Date]
date.timezone=Asia/Singapore

more reference here http://www.inmotionhosting.com/support/website/php/setting-the-timezone-for-php-in-the-phpini-file