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
Modern versions of PHP (>= 5.4.0) use the following steps until a default timezone is found:
Reading the timezone set using the date_default_timezone_set() function (if any)
Reading the value of the date.timezone ini option (if set)
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
;date.timezone =
; This is diasable text
This is working text
Get it? with this ; On some ini files you can disable some scripts/codes.
You can set your time zone in php like:
date_default_timezone_set('Europe/London');
And other like Europe/Amsterdam...
Read more on php default timezone
A simple code you have to write for the default timezone. which is:
date_default_timezone_get()
Now how to use:
You have to pass the timezone in this function like we want to set India timezone as default see:
date_default_timezone_set("Asia/Kolkata");
Now, whenever you would use date(), automatically return India timezone.
I would refer if you want a example: how to convert default date timezone in php
When not specified date.timezone defaults to the system environment variable TZ.
You can use this code to check your default value date_default_timezone_get()
.
Further info can be found here: http://www.php.net/manual/en/function.date-default-timezone-get.php