I save my dates as datetime in my db (e.g. 2013-09-23 15:00:00).
When I create an object I call this date by
$event->start
When I just echo it, I get the right value but it is a string and no longer a datetime. That is why this won't work:
date_format('d-m-Y', $event->start)
To use date() I need a timestamp, which I don't have. What is a possible solution?
I tried this:
date_format(strtotime($event->startdate), 'd-m-Y')
But still getting 'Date_format() expects parameter 1 to be DateTime'
SOLUTION
$dt = new DateTime($event->start);
echo $dt->format('d-m-Y');