Welcome Guest, Not a member yet? Register   Sign In
local to gmt function doesn't work
#1

(This post was last modified: 07-11-2017, 07:27 PM by ardavan.)

My server(localhost) timezone is Europe/Berlin.
I set both $config['time_reference'] = 'SGT'; and $config['time_reference'] = 'Asia/Singapore'; in config.php which is singapore time.

now I need to convert the local DateTime to GMT by using this code
PHP Code:
$local now();
echo 
'Local : '.nice_date(unix_to_human($local),'Y-m-d h:i A');
echo 
'GMT : '.nice_date(unix_to_human(local_to_gmt($local)),'Y-m-d h:i A'); 

And the result will be
Code:
Local : 2017-07-11 09:33 PM
GMT : 2017-07-11 07:33 PM

But the GMT time is not correct. At this time the GMT time is 1:33 PM NOT 7:33 PM

  1. by changing the $config['time_reference'] the application timezone will change?
  2. How to check which Timezone is being used by CodeIgniter?
  3. Is this a correct way to make use of Date helper to achieve my goal?
  4. How can I fix this?

Thanks in advance
Reply


Messages In This Thread
local to gmt function doesn't work - by ardavan - 07-11-2017, 06:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB