The default timezone is returned in order of preference by:
1 . After the timezone setting by the function
date_default_timezone_set.
2 . Reading the timezone environment variable, if not empty, (prior to PHP 5.4.0 only).
3 . Reading the value of
date.timezone ini option, if set.
The values of
date.timezone,
date.default_latitude,
date.default_longitude and
date.sunrise_zenith are defined in the
php.ini configuration file and should be changed if necessary.
Otherwise, the values of
date.timezone,
$latitude,
$longitude, and
$zenith must be supplied to the desired location.
The section of
php.ini where this can be done is shown below:
[PHP]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
date.timezone = 'America/Sao_Paulo'
; http://php.net/date.default-latitude
date.default_latitude = -23.5503948
; http://php.net/date.default-longitude
date.default_longitude = -46.634513
; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333
; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 . Prior to PHP 5.4.0 only: Querying the host operating system, (if supported and allowed by the OS).
This uses an algorithm that has to guess the timezone.
This is by no means going to work correctly for every situation.
Do not rely on it to be guessed correctly, and set
date.timezone to the correct timezone instead.
If none of the above succeed,
date_default_timezone_get will return a default timezone of UTC.
A
timezone basically is a region of the Earth that presents uniformity in the measurement of time for legal, commercial or social purposes.
Standard timezones can be defined by dividing the spheroidal surface of the Earth into 24 buds, with Greenwich meredian as a reference.
timezones are important in handling dates and time as well as in the preparation of calendars.