run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime(); $twoDaysAgo1 = new DateTime('-2 days'); $twoDaysAgo2 = new DateTime('-172800 seconds'); $twoDaysAgo3 = new DateTime('@' . ($now->getTimestamp() - 172800)); var_dump($twoDaysAgo1->getTimestamp()); var_dump($twoDaysAgo2->getTimestamp()); var_dump($twoDaysAgo3->getTimestamp());
based on 4R5lc
Output for 7.1.0RC3
int(1414879217) int(1414879217) int(1414879217)
Output for 7.1.0alpha1
int(1414882817) int(1414882817) int(1414882817)
Output for 7.0.6
int(1462081032) int(1462081032) int(1462081032)
Output for 7.0.5
int(1459449347) int(1459449347) int(1459449347)
Output for 7.0.4
int(1457416130) int(1457416130) int(1457416130)
Output for 7.0.3
int(1458109137) int(1458109137) int(1458109137)
Output for 7.0.2
int(1458475454) int(1458475454) int(1458475454)
Output for 7.0.1
int(1458580146) int(1458580146) int(1458580146)
Output for 7.0.0
int(1458845413) int(1458845413) int(1458845413)
Output for hhvm-3.12.0
int(1457537019) int(1457537019) int(1457537019)
Output for hhvm-3.10.0
int(1459136041) int(1459136041) int(1459136041)
Output for 5.6.21
int(1461977703) int(1461977703) int(1461977703)
Output for 5.6.20
int(1460045700) int(1460045700) int(1460045700)
Output for 5.6.19
int(1457164736) int(1457164736) int(1457164736)
Output for 5.6.18
int(1457816900) int(1457816900) int(1457816900)
Output for 5.6.17
int(1458211084) int(1458211084) int(1458211084)
Output for 5.6.16
int(1458938113) int(1458938113) int(1458934513)
Output for 5.6.15
int(1459027737) int(1459027737) int(1459024137)
Output for 5.6.14
int(1459379004) int(1459379004) int(1459379004)
Output for 5.6.13
int(1460516324) int(1460516324) int(1460516324)
Output for 5.6.12
int(1460910797) int(1460910797) int(1460910797)
Output for 5.6.11
int(1461195098) int(1461195098) int(1461195098)
Output for 5.6.10
int(1461374633) int(1461374633) int(1461374633)
Output for 5.6.9
int(1461565272) int(1461565272) int(1461565272)
Output for 5.6.8
int(1461766739) int(1461766739) int(1461766739)
Output for 5.6.7
int(1463989083) int(1463989083) int(1463989083)
Output for 5.5.35
int(1463718973) int(1463718973) int(1463718973)
Output for 5.5.34
int(1460145033) int(1460145033) int(1460145033)
Output for 5.5.33
int(1457282586) int(1457282586) int(1457282586)
Output for 5.5.32
int(1457997250) int(1457997250) int(1457997250)
Output for 5.5.31
int(1458307562) int(1458307562) int(1458307562)
Output for 5.5.30
int(1459290992) int(1459290992) int(1459290992)
Output for 5.5.29
int(1460653442) int(1460653442) int(1460653442)
Output for 5.5.28
int(1461008326) int(1461008326) int(1461008326)
Output for 5.5.27
int(1461103438) int(1461103438) int(1461103438)
Output for 5.5.26
int(1461469758) int(1461469758) int(1461469758)
Output for 5.5.25
int(1461664321) int(1461664321) int(1461664321)
Output for 5.5.24
int(1463849288) int(1463849288) int(1463849288)
Output for 5.4.45
int(1441428374) int(1441428374) int(1441428374)
Output for 5.4.44
int(1441428371) int(1441428371) int(1441428371)
Output for 5.4.43
int(1441428367) int(1441428367) int(1441428367)
Output for 5.4.42
int(1441428365) int(1441428365) int(1441428365)
Output for 5.4.41
int(1441428363) int(1441428363) int(1441428363)
Output for 5.4.40
int(1441428362) int(1441428362) int(1441428362)
Output for 5.4.39
int(1441428360) int(1441428360) int(1441428360)
Output for 5.4.38
int(1441428358) int(1441428358) int(1441428358)
Output for 5.4.37
int(1441428357) int(1441428357) int(1441428357)
Output for 5.4.36
int(1441428356) int(1441428356) int(1441428356)
Output for 5.4.35
int(1441428355) int(1441428355) int(1441428355)
Output for 5.4.15 - 5.4.34
int(1414879222) int(1414879222) int(1414879222)
Output for 5.3.24 - 5.4.14
int(1414879223) int(1414879223) int(1414879223)
Output for 5.3.2 - 5.3.23
int(1414879224) int(1414879224) int(1414879224)
Output for 5.3.0 - 5.3.1
int(1414879225) int(1414879225) int(1414879225)
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::getTimestamp() in /in/ekemD on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/ekemD on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/ekemD on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/ekemD on line 2