<?php /** * @param String $dateString * @return DateTime */ function updateDate($dateString){ $suppliedDate = new \DateTime($dateString); $currentYear = (int)(new \DateTime())->format('Y'); return (new \DateTime())->setDate($currentYear, (int)$suppliedDate->format('m'), (int)$suppliedDate->format('d')); } var_dump(updateDate('8th August 2011'));
You have javascript disabled. You will not be able to edit any code.