Skip to content

Instantly share code, notes, and snippets.

@ashfame

ashfame/time.php Secret

Last active August 29, 2015 13:59
Show Gist options
  • Save ashfame/e93709b755810168ed37 to your computer and use it in GitHub Desktop.
Save ashfame/e93709b755810168ed37 to your computer and use it in GitHub Desktop.
Timestamp of a time in a particular timezone
<?php
$datetimezone_object = new DateTimeZone('Pacific/Nauru'); // new DateTimeZone('PST');
$date = DateTime::createFromFormat( 'Y-m-d H:i:s', '2014-04-14 05:00:00', $datetimezone_object );
echo $date->getTimestamp();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment