- Mac OS X 10.7.4
- PHP 5.3.8 (system-supplied)
-
-
Save gustavderdrache/2727123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> php | |
<?php | |
$startDate = new DateTime('@100'); | |
$endDate = new DateTime('@200'); | |
$oneSecondInterval = new DateInterval('PT1S'); | |
echo "Start date, @100: " . dt_format($startDate) . "\n"; | |
echo "End date, @200: " . dt_format($endDate). "\n"; | |
echo "\n"; | |
$startDate->add($oneSecondInterval); | |
echo "New Start Date, @100 + PT1S: " . dt_format($startDate) . "\n"; | |
function dt_format(DateTime $dt) | |
{ | |
return $dt->format('r') . " - " . $dt->getTimestamp(); | |
} | |
Start date, @100: Thu, 01 Jan 1970 00:01:40 +0000 - 100 | |
End date, @200: Thu, 01 Jan 1970 00:03:20 +0000 - 200 | |
New Start Date, @100 + PT1S: Thu, 01 Jan 1970 01:01:41 +0000 - 3701 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment