Skip to content

Instantly share code, notes, and snippets.

@aa21
Last active July 4, 2016 09:39
Show Gist options
  • Save aa21/a8afae7ee20ed1f2bf9973ed892f919b to your computer and use it in GitHub Desktop.
Save aa21/a8afae7ee20ed1f2bf9973ed892f919b to your computer and use it in GitHub Desktop.
<?php
// if it's not a ISO8601 date string, skip it
if(stripos($v , "T") === false) continue;
$dateval = $v;
// create ISO8601 dateTime
$date = DateTime::createFromFormat(DateTime::ISO8601, $dateval);
// set to user's timezone
$date -> setTimeZone($dt_user_timezone);
// assign back to main events array
$events[$id][$k] = $date -> format(DateTime::ISO8601);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment