Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: DATE_DIFF function #16534

Open
BohuTANG opened this issue Sep 27, 2024 · 2 comments
Open

feature: DATE_DIFF function #16534

BohuTANG opened this issue Sep 27, 2024 · 2 comments
Assignees
Labels
C-feature Category: feature good first issue Category: good first issue

Comments

@BohuTANG
Copy link
Member

Summary

Databend lacks a DATE_DIFF function, though it supports direct arithmetic on dates and times (e.g., TO_DATE(NOW()) - 2 for two days ago). However, users may find this conversion difficult, see: https://docs.databend.com/sql/sql-functions/datetime-functions/date-diff

Proposal add a DATE_DIFF function:

DATE_DIFF(<date_or_time_part>, <date_or_time_expr1>, <date_or_time_expr2>)

Similar to Snowflake's DATEDIFF function, this will simplify date and time arithmetic for users.

@BohuTANG BohuTANG added C-feature Category: feature good first issue Category: good first issue labels Sep 27, 2024
@chagelo
Copy link

chagelo commented Sep 28, 2024

I would like to have a try.

@chagelo
Copy link

chagelo commented Oct 1, 2024

  1. Should select to_date('2024-02-29') + - to_date('2025-02-28'); be valid or invalid? I mean the add operation between two date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature good first issue Category: good first issue
Projects
None yet
Development

No branches or pull requests

2 participants