I created a node type with a date field (from the date module). I list nodes of this type in a view. The problem I have is that the date values being shown by the view are in UTC (ie as they are stored in the db) not in the user's local timezone. I have tried the following to no avail:
1) Unchecked "Administration » Configuration » Regional and language » Users may set their own time zone". I then logged out and cleared the cache.
2) Verified that if I view the node outside of the view (ex: going to http://mysite.local/node/123), the time appears in the proper timezone. The proper dates are also shown when editing the node.
3) Tried to format the date using this code:
format_date($date, 'custom', 'D d/m/Y - g:ia', date_default_timezone_get())
$date
is a timestamp and date_default_timezone_get()
returns the proper timezone.
4) Tried this with the date_views modules enabled and disabled.
For some reason the view pulls the date field value straight from the db without converting it to the proper timezone. Unfortunately, I don't know how to either 1) tell views how to convert it properly, or 2) convert it manually in a template.
Note: I refuse to hard-code my timezone into my template. This is a terrible option I've seen when searching for an answer to this.