How to set default time zone in PHP
0 3086
date_default_timezone_set() function is used to set default timezone in PHP. This is an inbuilt function. One parameter is used to set the default timezone. You just have to define which one type of timezone you wanna set.
Example:
<?php date_default_timezone_set('Asia/Dubai'); echo date("d-M-Y h:i"); ?>
Output: 04-Aug-2019 09:47
If i sent the another timezone then it gives different timezone.
<?php date_default_timezone_set('Asia/Kolkata'); echo date("d-M-Y h:i"); ?>
Output: 04-Aug-2019 11:17
Share:
Comments
Waiting for your comments