I am trying to convert the date in the following manner and its working fine
$strdate = '1st of September 2014 Mon';
contime($strdate);
Now, I tried to convert the date in the following manner and its not working
$strdate = $fetch_resdetails['coupondate'];
contime($strdate);
I am getting Fatal error: Call to a member function format()
PHP Class:
function contime($gettime) {
$date = DateTime::createFromFormat("jS \of F Y D", $gettime);
return $date->format('Ymd');
}
Why does the $strdate
works perfectly and $fetch_resdetails['coupondate'];
doesn't work?
even when echo $fetch_resdetails['coupondate'];
prints as '1st of September 2014 Mon'
;