- date_default_timezone_set: documentation ( source)
<?php
date_default_timezone_set('GMT');
function runTest($a) {
print "Before: " . $a->getTimestamp() . "\n";
$b = $a->modify('+1 day');
print "Result after: " . $b->getTimestamp() . "\n";
print "Original after: " . $a->getTimestamp() . "\n";
}
print "Immutable:\n";
runTest(new DateTimeImmutable('12/12/2012 12:12:12'));
print "\n\nStandard:\n";
runTest(new DateTime('12/12/2012 12:12:12'));