Created
December 18, 2017 15:58
-
-
Save Joncom/93fb0c8db6eb813a816f08bbb1a35381 to your computer and use it in GitHub Desktop.
Converting to and from UTC and Unix time
This file contains 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
<?php | |
// Convert UTC time string to Unix time interger. | |
$timestamp = strtotime ( '2014-12-29 12:30:21+0000' ); | |
// Convert Unix time integer back to UTC time string. | |
echo gmdate(DateTime::ISO8601, $timestamp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment