How to Set Timezone using PHP

DateTimeZone is the representation of time zone. You can change the timezone using this function.
For example, If you want Indian time zone, use “Asia/Kolkata”.
$dtz = new DateTimeZone("Asia/Kolkata"); //Your timezone $now = new DateTime(date("Y-m-d"), $dtz); echo $now->format("Y-m-d H:i:s");
This link will give you a list of time zones.
http://www.php.net//manual/en/timezones.php
Use this function date_default_timezone_get() to know the default timezone of your server.
$timezone = date_default_timezone_get(); echo "The current server timezone is: " . $timezone;
OUTPUT: The current server timezone is: Europe/Paris
Hola! I’ve been reading your blog for a long time now and finally got the courage to go ahead and give you a shout out from Huffman Tx!
Just wanted to tell you keep up the great work!
Thank you.