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.


You can use Global PHP filed to convert the date in user's proper timezone using code. Your date field value will be the input here. If it works then use this field instead and set the original date field to 'exclude from display' in your view.


I just ran into this problem recently and saw this post without a real solution. For me editing the Date field in the content type and setting the "Time zone handling" to "No time zone conversion" than re-saving the nodes solved the problem.

protected by kiamlaluno May 8 at 8:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.