default timezone in PHP

前端 未结 4 738
礼貌的吻别
礼貌的吻别 2021-01-14 08:42

What is default timezone in php? I checked it in the php.ini which shows the following with the timezone is left blank:

[Date]
; Defines the default timezone         


        
4条回答
  •  生来不讨喜
    2021-01-14 08:48

    PHP 7 Answer

    Modern versions of PHP (>= 5.4.0) use the following steps until a default timezone is found:

    1. Reading the timezone set using the date_default_timezone_set() function (if any)

    2. Reading the value of the date.timezone ini option (if set)

    3. If none of the above succeed, the default timezone will be UTC.

    The TZ environment variable is no longer used.

    Source: https://www.php.net/manual/en/function.date-default-timezone-get.php

提交回复
热议问题