I have an Event
content type with a Date
field with a start and end date.
When this field is being displayed in a view, it displays properly, with the time matching the value that was entered.
On a different page, I am overriding field--field-date.tpl.php
and using date_create
and date_format
to print out the date and time separately.
$start_date = date_create($node->field_date['und'][0]['value']); //dont hate me
$end_date = date_create($node->field_date['und'][0]['value2']);
//...
print date_format($start_date, 'g:i A') . ' - ' . date_format($end_date, 'g:i A');
As you can see, it is displaying 4:00pm instead of 12:00pm. It looks like a timezone translation is happening (or not happening) somewhere. I tried to screw around with the time zone argument for date_create
but nothing actually changed the way the date displayed.
When I dump the date field out with devel, I get,
dpm($node->field_date['und'][0]['value']);
dpm($start_date);
How do I actually display the proper timezone for my date with PHP in my field--field-date.tpl.php
?