Get server default timezone in Php controllers

It seems that Nextcloud is forcing Php default timezone to ‘UTC’, whether ‘date.timezone’ is set or not in php.ini. Is it possible to avoid that ?

I placed a phpinfo() at the beginning of an index method of one of my controllers and it tells me :

Default timezone UTC
and
date.timezone Europe/Paris

another phpinfo() in a Php file outside of Nextcloud. It tells me :

Default timezone Europe/Paris
and
date.timezone Europe/Paris

so each Datetime i declare in PhoneTrack’s controllers from a string formatted like ‘YYYY-MM-DD hh:mm:ss’ is in UTC timezone… I would like it to adapt to the server timezone.

My temporary and dirty fix is to use the value of ‘date.timezone’ with the Php function ‘ini_get()’ to manually set the default timezone with ‘date_default_timezone_set()’ but it obviously only work if date.timezone is set in php.ini, otherwise it’s still UTC.

  • Is the default timezone modified on purpose by Nextcloud ?
  • Is it possible to retrieve the ‘real’ default timezone from an app’s controller ?