3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Add/Subtract days from a date function dateMath($startDate, $math) { $math = $math." day"; $date = new DateTime($startDate); $date->modify($math); return($date->format('Y-m-d')); } echo dateMath('2016-11-17', -1);
Output for 5.6.0 - 7.3.0alpha1
2016-11-16