Skip to content

Instantly share code, notes, and snippets.

@glennpratt
Created August 23, 2010 20:55
Show Gist options
  • Save glennpratt/546317 to your computer and use it in GitHub Desktop.
Save glennpratt/546317 to your computer and use it in GitHub Desktop.
<?php
$date = new DateTime('2011-03-13T03:00:00', timezone_open('America/Chicago'));
dpm($date->format('c e'));
$date2 = clone($date);
$date2->modify('-2 minutes');
dpm($date2->format('c e'));
if ($date->format('U') < $date2->format('U')) {
$date2->modify('-120 minutes');
}
dpm($date2->format('c e'));
?>
2011-03-13T03:00:00-05:00 America/Chicago <-- Start
2011-03-13T03:58:00-05:00 America/Chicago <-- -2 min, WTF
2011-03-13T01:58:00-06:00 America/Chicago <-- -2 min, -60 min, OK?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment