Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views Date Format SQL

Security covered Maintenance fixes only 3,098 sites

Part of the Views ecosystem · 280 projects

This module formats date fields using SQL, allowing for more efficient date aggregation in Views. It moves date formatting from PHP to the database query, enabling grouping by year, month, or day directly within SQL. This is useful for creating reports that aggregate data based on specific date granularities.

The Views Date Format SQL module allows to format date fields using SQL. This enables group aggregation for date fields using the choosen granularity.

The core functionality is to remove the date formatting from render() and put it in query(). I.e. format date values using SQL's DATE_FORMAT rather than PHP's format_date.
This is achieved by assigning a new default handler to node 'created' and 'changed' date fields. This handler extends and overrides views's build in views_handler_field_date.

The UI is completely unobtrusive, only a single checkbox "Use SQL to format dates" is added to the handler configuration popup.

Written for and tested with Views 3. This code is rather simple and should really go into views core some day.

Usage:

  • Add or edit a view.
  • Enable Aggregation.
  • Add a date field or edit one by clicking the field name.
  • In the "Configure Field" pop-up look for "Use SQL to format date"
  • Try setting the date format to something like "Y-m" for monthly reports

Ask your assistant about Views Date Format SQL

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
4
Tracked since
Mar 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
8.x-3.0-alpha6 Pre-release 10–11 Nov 23, 2024
8.x-3.0-alpha5 Pre-release 9–11 Nov 13, 2024
8.x-3.0-alpha4 Pre-release 9–11 Sep 24, 2024
8.x-3.0-alpha3 Pre-release 8–10 Mar 29, 2023