i'am trying to format a mysql datetime-value to another format for the view.
I tried several methods, for example:
$date = new DateTime($datetime, new DateTimeZone('Europe/Berlin'));
return $date->format("Y-m-d H:i");
But it doesn't work.
The problem is, that (i think..) PHP manipulates the value. The output is always the current datetime and not the value which is saved in the database. For example "2011-04-21 22:27:42".
Does anyone has an idea how the solve this problem?
Greetings.
My guess is that $datetime
isnt set
The first parameter of DateTime is defaulted to now if it's not set