StrangeWill Posted January 4, 2007 Share Posted January 4, 2007 date_default_timezone_set('UTC');echo("<br><br>Local:".time());echo("<br>UTC:".date('U').'<br><br>');I was being lazy and was hoping I could get UTC time without having to put in the time offset of the server.Can this be done? Link to comment https://forums.phpfreaks.com/topic/32782-get-utc-time/ Share on other sites More sharing options...
AndyB Posted January 4, 2007 Share Posted January 4, 2007 Isn't UTC the same as GMT? gmdate() should do it. Link to comment https://forums.phpfreaks.com/topic/32782-get-utc-time/#findComment-152621 Share on other sites More sharing options...
StrangeWill Posted January 4, 2007 Author Share Posted January 4, 2007 GMT:1167875911Local:1167875911UTC:1167875911Using:[code=php:0]echo("<br><br>GMT:".gmmktime());echo("<br><br>Local:".time());date_default_timezone_set('UTC');echo("<br>UTC:".date('U').'<br><br>');[/code] Link to comment https://forums.phpfreaks.com/topic/32782-get-utc-time/#findComment-152624 Share on other sites More sharing options...
StrangeWill Posted January 4, 2007 Author Share Posted January 4, 2007 Nevermind, "U" always returns GMT/UTC Link to comment https://forums.phpfreaks.com/topic/32782-get-utc-time/#findComment-152627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.