Skip to content

Instantly share code, notes, and snippets.

@Joncom

Joncom/timestamp.php

Created Dec 18, 2017
Embed
What would you like to do?
Converting to and from UTC and Unix time
<?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
You can’t perform that action at this time.