making an SQL date column visible to a Drupal view
Posted
by Donal
on Stack Overflow
See other posts from Stack Overflow
or by Donal
Published on 2010-05-12T18:04:09Z
Indexed on
2010/05/12
21:34 UTC
Read the original article
Hit count: 183
drupal
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 .
© Stack Overflow or respective owner