Hi folks,
weekend is here hope you all have fun and go see Star Wars 🙂
function formatTime($myTime)
{
preg_match('#(\\d{1,2})[:\\.](\\d{1,2})[\\s]*(am|pm)#i', $myTime, $matches);
$meridien = $matches[3];
$timestamp = strtotime(str_replace('.', ':', $myTime));
return date('YmdHis', $timestamp);
}
$test = array('2.25 am', '10:30 am', '12.10 pm', '8.00 pm', '10.30 pm', '12.30 am', '1.00 am', '3.30 am');
foreach ($test as $x)
{
echo formatTime($x) . '<br>';
}
What i need to do is once it goes thru the am and pm times then it moves into the next day am times is increment by 24hrs.
i know to use 24 60 60 but i dont know how to track that it has reached midnight and going into the next day 🙁
appreciate your help folks, thanks.