diff --git a/_posts/05-03-01-Date-and-Time.md b/_posts/05-03-01-Date-and-Time.md index b7fe666..0d9a6de 100644 --- a/_posts/05-03-01-Date-and-Time.md +++ b/_posts/05-03-01-Date-and-Time.md @@ -24,6 +24,7 @@ take a DateInterval as an argument. Do not write code that expect same number of saving and timezone alterations will break that assumption. Use date intervals instead. To calculate date difference use the `diff()` method. It will return new DateInterval, which is super easy to display. {% highlight php %} +add(new \DateInterval('P1M6D')); @@ -35,6 +36,7 @@ echo "Difference: " . $diff->format('%m month, %d days (total: %a days)') . "\n" On DateTime objects you can use standard comparison: {% highlight php %} +