如何使用Date模块在Drupal中正确显示时间?

When creating a new Event on my Drupal site I set the date/time of the event to what I assume is local time. I expected the date/time in the system to be set to the value I saw on the add/edit form, but its not; it's set to UTC.

Event Start (add/edit form): 2012-12-20 1:00pm EST
Event Start (database):      2012-12-20 6:00pm UTC

When I go to display this date/time using date() even after setting the default timezone to EST ("America/Toronto") the date/time is still showing 2012-12-20 6:00pm.

The problem doesn't necessarily seem to be drupal, the date/time is being displayed in the way it's being stored, but I'm thinking the problem may be the date/time entry control on the add/edit form...possible javascript time related.


The values are being posted as they're displayed: 5:00pm goes to the server as 3 distinct values: 5, 00, PM. They're being stored in the database as UTC, but not matter what I try they're always displayed as UTC. I've tried format_date, date_default_timezone_set, setting the PHP timezone in the .htaccess file...no luck :s


Hate having to do it manually, but this works:

$tz = new DateTimeZone('America/Toronto');  
$offset = $tz->getOffset(new DateTime($start_date));
$start_stamp = strtotime($start_date) + $offset;

If you have a date formatter (config page at /admin/config/regional/date-time), you can use the machine name to reuse it:

$date = new DateObject($timestamp);
$value = date_format_date($date, 'my_date_string_format');