Skip to content

Instantly share code, notes, and snippets.

@angeloped
Last active March 24, 2019 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angeloped/7119e1815a4adc18b35dac9582d05aa7 to your computer and use it in GitHub Desktop.
Save angeloped/7119e1815a4adc18b35dac9582d05aa7 to your computer and use it in GitHub Desktop.
Unix timestamp by timezone in PHP.
<?php
# note: $_REQUEST["tz"] is variable of your timezone. arg example: Asia/Manila
if(isset($_REQUEST["tz"])){
date_default_timezone_set($_REQUEST["tz"]);
$datetime = new DateTime();
echo $datetime->format('Y-m-d H:i:s');
die();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment