making an SQL date column visible to a Drupal view
- by Donal
I'm trying to make a table visible to Views. One of the columns has type date (as opposed to a Unix timestamp). The example I initially tried to copy from is in modules/comment.views.inc in the Views module:
// timestamp (when comment was posted)
$data['comments']['timestamp'] = array(
'title' => t('Post date'),
'help' => t('Date and time of when the comment was posted.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
);
This makes the dates, which are all in the past year or so, show up as "1 Jan 1970 00:33", so evidently a value of '2010-05-12', for example, is being interpreted as 2010 seconds past 1 Jan 1970 00:00.
Can anyone point me to a correct way of exporting date columns?
EDIT: I'm following up on some clues found at http://drupal.org/node/476774 .