Last active
August 29, 2015 14:12
-
-
Save jayjayswal/130e261c3b9c9c6d87c6 to your computer and use it in GitHub Desktop.
Convert mysql UTC timestamp to Local timestamp PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convert_time($timestamp,$timezone) | |
{ | |
date_default_timezone_set("UTC"); | |
$time_object = new DateTime($timestamp, new DateTimeZone('UTC')); | |
$time_object->setTimezone(new DateTimeZone($timezone)); | |
return $time_object->format('Y-m-d g:i A'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment