3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $endDate = strtotime('2015-03-30 11:59:59'); $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; echo $endDate;
based on C9sSv
Output for 5.1.2 - 7.2.0
2015-03-30 11:00:002015-03-30 11:30:00
Output for 5.1.0 - 5.1.1
1970-01-01 01:00:002015-03-30 11:30:00
Output for 4.3.0 - 5.0.5
2015-03-30 12:00:002015-03-30 11:30:00