[SOLVED]Date.timezone displaying wrong country?

This is the default code from the PHP docs.

date_default_timezone_set('Asia/Calcutta');

if (date_default_timezone_get()) {
    echo 'date_default_timezone_get: ' . date_default_timezone_get(). '<br/>';
}

if (ini_get('date.timezone')){
    echo 'date.timezone: ' . ini_get('date.timezone');
}

But it is showing me this output

date_default_timezone_get: Asia/Calcutta
date.timezone: Europe/Berlin

timezone_get is correct but date.timezone is showing Europe, why??

date_default_timezone_set does not change the ini settings, it’s scope is script level only.

If you want the change to be more lasting, you should edit the ini file.

1 Like

Yes, I just thought the same and it works, Thanks for the help.
Have to change the date.timezone in php.ini file

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone=Asia/Calcutta
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.