Extend database abstraction layer to include database specific date routines

Created on 4 December 2011, over 13 years ago
Updated 14 April 2025, 8 days ago

In Drupal 7, as it supports different databases, modules which run queries containing date conversions and comparisons (Views, Date and others) face with a number of bugs connected to different SQL syntax. At the same time these modules have a lot of almost identical code related to DB date handling. Date functions are a part of SQL and I think they should not be handled by modules. We need a kind of date abstraction layer within database layer, which will contain date formatting, conversion, and extraction routines. I don't know if current DB layer can be changed too much, but the idea can become a roadmap for Drupal 8.

Suggested functions can include:
- date formatting function;
- date diff;
- date addition and subtraction;
- date parts extraction;
- date comparison (however I'm not sure if we really need this one);
- timezone handling.

Functions can operate on PHP DateTime, DateTimeZone, DateInterval objects.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

database system

Created by

πŸ‡ΊπŸ‡¦Ukraine d.novikov

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024