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

How to set default time zone in PHP

by Lalita

0 3316

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:

SSL for business, from $12.88


Leave a Reply


Comments
    Waiting for your comments

Coding Tag WhatsApp Chat
Coding Tag WhatsApp Chat