<?php
//$tz = new DateTimeZone('Europe/Amsterdam');
foreach (DateTimeZone::listIdentifiers() as $tz) {
$now = new DateTime('2015-10-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 9, $diff->format('%m'));
$now = new DateTime('2015-09-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 8, $diff->format('%m'));
$now = new DateTime('2015-11-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 10, $diff->format('%m'));
}
preferences:
57.83 ms | 402 KiB | 5 Q