<?php
$dateTime = new DateTime();
$midnight = new DateTimeImmutable($dateTime->format('Ymd'), $dateTime->getTimezone());
var_dump($dateTime->format(DATE_ISO8601));
var_dump($dateTime->getTimezone());
var_dump($midnight->format(DATE_ISO8601));
var_dump($midnight->getTimezone());
- Output for 5.5.0 - 5.5.2, 5.5.5 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- string(24) "2014-10-26T22:42:17+0100"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
string(24) "2014-10-26T00:00:00+0200"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
- Output for 7.3.32 - 7.3.33, 8.0.13
- string(24) "2014-10-26T21:42:17+0000"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
string(24) "2014-10-26T00:00:00+0000"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
- Output for 5.5.3 - 5.5.4
- string(24) "2014-10-26T22:42:18+0100"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
string(24) "2014-10-26T00:00:00+0200"
object(DateTimeZone)#3 (2) {
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
- Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
- Fatal error: Class 'DateTimeImmutable' not found in /in/L09TQ on line 4
Process exited with code 255. - Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
- Fatal error: Class 'DateTime' not found in /in/L09TQ on line 3
Process exited with code 255. - Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
- Fatal error: Cannot instantiate non-existent class: datetime in /in/L09TQ on line 3
Process exited with code 255. - Output for 4.3.0 - 4.3.1
- Fatal error: Cannot instantiate non-existent class: datetime in /in/L09TQ on line 3
preferences:
285.72 ms | 401 KiB | 452 Q