I am trying to get dates from PHP (I receive them from a database in the format 2014-09-16 22:00:00).
I then create an object in PHP because I have to work on those date in some occasions and I use:
$output[$i]['when'] = new DateTime($output[$i]['when'], new DateTimeZone('Europe/Brussels'));
Then I send that back in the javascript code with the following PHP command:
$line['when']->format('U')*1000
In fact, this line is in a foreach meaning that is the reason why you don't see a [$i].
My problem is that when going into javascript, it shows as 2 hours before. I am in CET and as I understand the format('U') means UTC. But I thought with specifying the datetimezone, this would work. How can I solve this? I know there is a 2 hours difference between CET and UTC so should I had that in milliseconds then * 1000 to have the microseconds?
EDIT: The 2 hours difference is only for some months, then it becomes 1 hour difference. I have then no idea how to solve this.
Thanks if you can help.