3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fileDate = DateTime::createFromFormat("Ymd", "19350320"); $now = new DateTime("now"); echo $fileDate->format("Ymd").' '; echo $now->format("Ymd").' '; $diff1 = $now->diff($fileDate, true); echo $diff1->format("Y-m-d"); ?>
based on 7FdRg
Output for 5.3.20 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
19350320 20151130 Y-m-d
Output for 7.0.6
19350320 20160503 Y-m-d
Output for 7.0.5
19350320 20160403 Y-m-d
Output for 7.0.4
19350320 20160310 Y-m-d
Output for 7.0.3
19350320 20160318 Y-m-d
Output for 7.0.2
19350320 20160323 Y-m-d
Output for 7.0.1
19350320 20160324 Y-m-d
Output for 7.0.0
19350320 20160327 Y-m-d
Output for 5.6.21
19350320 20160502 Y-m-d
Output for 5.6.20
19350320 20160410 Y-m-d
Output for 5.6.19
19350320 20160308 Y-m-d
Output for 5.6.18
19350320 20160315 Y-m-d
Output for 5.6.17
19350320 20160320 Y-m-d
Output for 5.6.16
19350320 20160328 Y-m-d
Output for 5.6.15
19350320 20160329 Y-m-d
Output for 5.6.14
19350320 20160402 Y-m-d
Output for 5.6.13
19350320 20160415 Y-m-d
Output for 5.6.12
19350320 20160420 Y-m-d
Output for 5.6.11
19350320 20160424 Y-m-d
Output for 5.6.10
19350320 20160425 Y-m-d
Output for 5.6.9
19350320 20160427 Y-m-d
Output for 5.6.8
19350320 20160430 Y-m-d
Output for 5.5.35
19350320 20160522 Y-m-d
Output for 5.5.34
19350320 20160411 Y-m-d
Output for 5.5.33
19350320 20160309 Y-m-d
Output for 5.5.32
19350320 20160317 Y-m-d
Output for 5.5.31
19350320 20160321 Y-m-d
Output for 5.5.30
19350320 20160401 Y-m-d
Output for 5.5.29
19350320 20160417 Y-m-d
Output for 5.5.28
19350320 20160421 Y-m-d
Output for 5.5.27
19350320 20160422 Y-m-d
Output for 5.5.26
19350320 20160426 Y-m-d
Output for 5.5.25
19350320 20160429 Y-m-d
Output for 5.5.24
19350320 20160524 Y-m-d