<?php $string = '18 hours and 14 minutes ago'; $regex = '#\d+\s\w+#'; preg_match_all($regex, $string, $matches); $date = new DateTime(); echo 'current date = '.$date->format('Y-m-d H:i:s')."\n"; foreach ($matches[0] as $modify) { $date->modify('-'.$modify); } echo 'modified date = '.$date->format('Y-m-d H:i:s');
You have javascript disabled. You will not be able to edit any code.