How to set default time zone in PHP || PHP Examples
×


How to set default time zone in PHP

2983

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



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments