3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tz = new DateTimeZone('America/Los_Angeles'); $now = new DateTime('now', $tz); $now = new DateTime('03 Nov 2014'); $twoDaysAgo1 = new DateTime('-2 days', $tz); $twoDaysAgo1_1 = $now->sub(new DateInterval('P2D')); $twoDaysAgo2 = new DateTime('-172800 seconds', $tz); $twoDaysAgo3 = new DateTime('@' . ($now->getTimestamp() - 172800), $tz); var_dump($twoDaysAgo1->getTimestamp()); var_dump($twoDaysAgo1_1->getTimestamp()); var_dump($twoDaysAgo2->getTimestamp()); var_dump($twoDaysAgo3->getTimestamp());
based on lWQH7
Output for 5.6.28, 7.0.14 - 7.1.0
int(1414876091) int(1414796400) int(1414876091) int(1414623600)
Output for 7.0.6
int(1462084055) int(1414796400) int(1462084055) int(1414623600)
Output for 7.0.5
int(1459452230) int(1414796400) int(1459452230) int(1414623600)
Output for 7.0.4
int(1457419419) int(1414796400) int(1457419419) int(1414623600)
Output for 7.0.3
int(1458112621) int(1414796400) int(1458112621) int(1414623600)
Output for 7.0.2
int(1458478952) int(1414796400) int(1458478952) int(1414623600)
Output for 7.0.1
int(1458583464) int(1414796400) int(1458583464) int(1414623600)
Output for 7.0.0
int(1458848429) int(1414796400) int(1458848429) int(1414623600)
Output for hhvm-3.12.0
int(1459106471) int(1414796400) int(1459106471) int(1414623600)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.21
int(1461980859) int(1414796400) int(1461980859) int(1414623600)
Output for 5.6.20
int(1460053026) int(1414796400) int(1460053026) int(1414623600)
Output for 5.6.19
int(1457189451) int(1414796400) int(1457189451) int(1414623600)
Output for 5.6.18
int(1457825803) int(1414796400) int(1457825803) int(1414623600)
Output for 5.6.17
int(1458214512) int(1414796400) int(1458214512) int(1414623600)
Output for 5.6.16
int(1458937584) int(1414796400) int(1458937584) int(1414623600)
Output for 5.6.15
int(1459027159) int(1414796400) int(1459027159) int(1414623600)
Output for 5.6.14
int(1459381984) int(1414796400) int(1459381984) int(1414623600)
Output for 5.6.13
int(1460519324) int(1414796400) int(1460519324) int(1414623600)
Output for 5.6.12
int(1460914030) int(1414796400) int(1460914030) int(1414623600)
Output for 5.6.11
int(1461198512) int(1414796400) int(1461198512) int(1414623600)
Output for 5.6.10
int(1461377830) int(1414796400) int(1461377830) int(1414623600)
Output for 5.6.9
int(1461568480) int(1414796400) int(1461568480) int(1414623600)
Output for 5.6.8
int(1461770166) int(1414796400) int(1461770166) int(1414623600)
Output for 5.6.7
int(1463998422) int(1414796400) int(1463998422) int(1414623600)
Output for 5.5.35
int(1463722205) int(1414796400) int(1463722205) int(1414623600)
Output for 5.5.34
int(1460148027) int(1414796400) int(1460148027) int(1414623600)
Output for 5.5.33
int(1457285978) int(1414796400) int(1457285978) int(1414623600)
Output for 5.5.32
int(1458001701) int(1414796400) int(1458001701) int(1414623600)
Output for 5.5.31
int(1458310915) int(1414796400) int(1458310915) int(1414623600)
Output for 5.5.30
int(1459294058) int(1414796400) int(1459294058) int(1414623600)
Output for 5.5.29
int(1460656441) int(1414796400) int(1460656441) int(1414623600)
Output for 5.5.28
int(1461011596) int(1414796400) int(1461011596) int(1414623600)
Output for 5.5.27
int(1461107082) int(1414796400) int(1461107082) int(1414623600)
Output for 5.5.26
int(1461472986) int(1414796400) int(1461472986) int(1414623600)
Output for 5.5.25
int(1461667608) int(1414796400) int(1461667608) int(1414623600)
Output for 5.5.24
int(1463852885) int(1414796400) int(1463852885) int(1414623600)
Output for 5.4.45
int(1441428404) int(1414796400) int(1441428404) int(1414623600)
Output for 5.4.44
int(1441428401) int(1414796400) int(1441428401) int(1414623600)
Output for 5.4.43
int(1441428397) int(1414796400) int(1441428397) int(1414623600)
Output for 5.4.42
int(1441428396) int(1414796400) int(1441428396) int(1414623600)
Output for 5.4.41
int(1441428394) int(1414796400) int(1441428394) int(1414623600)
Output for 5.4.40
int(1441428393) int(1414796400) int(1441428393) int(1414623600)
Output for 5.4.39
int(1441428391) int(1414796400) int(1441428391) int(1414623600)
Output for 5.4.38
int(1441428390) int(1414796400) int(1441428390) int(1414623600)
Output for 5.4.37
int(1441428388) int(1414796400) int(1441428388) int(1414623600)
Output for 5.4.36
int(1441428387) int(1414796400) int(1441428387) int(1414623600)
Output for 5.4.35
int(1441428386) int(1414796400) int(1441428386) int(1414623600)
Output for 5.4.24 - 5.4.34
int(1414876096) int(1414796400) int(1414876096) int(1414623600)
Output for 5.4.2 - 5.4.23
int(1414876097) int(1414796400) int(1414876097) int(1414623600)
Output for 5.3.11 - 5.4.1
int(1414876098) int(1414796400) int(1414876098) int(1414623600)
Output for 5.3.3 - 5.3.10
int(1414876099) int(1414796400) int(1414876099) int(1414623600)
Output for 5.3.0 - 5.3.2
int(1414876099) int(1414450800) int(1414876099) int(1414450800)
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::sub() in /in/BYMKa on line 6
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/BYMKa on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/BYMKa on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/BYMKa on line 2