3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $endDate = strtotime('2015-03-30 12:31:00'); $endDate -= $endDate % 1800; $endDate = date('Y-m-d H:i:s', $endDate); $startDate = date('Y-m-d H:i:s', strtotime($endDate . " - 1800 seconds")); echo $startDate . ' - ' . $endDate;
based on bk2P6
Output for 5.1.2 - 7.2.0
2015-03-30 12:00:00 - 2015-03-30 12:30:00
Output for 5.1.0 - 5.1.1
1970-01-01 01:00:00 - 2015-03-30 12:30:00
Output for 4.3.0 - 5.0.5
2015-03-30 13:00:00 - 2015-03-30 12:30:00