1 <p>Custom modules and add their own dates to the list the
<a href=
"&topic:date_api/date-filter&">Date API Views filter
</a> and
<a href=
"&topic:date_api/date-argument&">Date API Views argument
</a> can handle. See the following example for the way that core dates have been added:
</p>
4 * Implementation of hook_date_api_fields().
5 * on behalf of core fields.
7 * All modules that create custom fields that use the
8 * 'views_handler_field_date' handler can provide
9 * additional information here about the type of
10 * date they create so the date can be used by
11 * the Date API views date argument and date filter.
13 function date_api_date_api_fields($field) {
15 // The type of date: DATE_UNIX, DATE_ISO, DATE_DATETIME.
16 'sql_type' =
> DATE_UNIX,
17 // Timezone handling options: 'none', 'site', 'date', 'utc'.
18 'tz_handling' =
> 'site',
19 // Needed only for dates that use 'date' tz_handling.
20 'timezone_field' =
> '',
21 // Needed only for dates that use 'date' tz_handling.
23 // Array of
"table.field" values for related fields that should be
24 // loaded automatically in the Views SQL.
25 'related_fields' =
> array(),
26 // Granularity of this date field's db data.
27 'granularity' =
> array('year', 'month', 'day', 'hour', 'minute', 'second'),
36 case 'node_revisions.timestamp':
37 case 'files.timestamp':
38 case 'node_counter.timestamp':
39 case 'accesslog.timestamp':
40 case 'comments.timestamp':
41 case 'node_comment_statistics.last_comment_timestamp':