Skip to content

Instantly share code, notes, and snippets.

@michaelbramwell
Created September 7, 2016 03:07
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 michaelbramwell/6b0a5f73ae1f9de4b482a092fad38d8c to your computer and use it in GitHub Desktop.
Save michaelbramwell/6b0a5f73ae1f9de4b482a092fad38d8c to your computer and use it in GitHub Desktop.
Set Time Zone From ISO8601 String
private function SetTimeZone($dtStr)
{
$newDt = DateTime::createFromFormat(DateTime::ISO8601, $dtStr);
$newDt->setTimezone(new DateTimeZone('Australia/Perth'));
$newDtStr = $newDt->format("c");
return $newDtStr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment