You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ruan Hang (Jira)" <ji...@apache.org> on 2025/11/10 02:08:00 UTC
[jira] [Updated] (FLINK-28929) Add built-in datediff function.
[ https://issues.apache.org/jira/browse/FLINK-28929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruan Hang updated FLINK-28929:
------------------------------
Fix Version/s: 2.3.0
(was: 2.2.0)
> Add built-in datediff function.
> -------------------------------
>
> Key: FLINK-28929
> URL: https://issues.apache.org/jira/browse/FLINK-28929
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Affects Versions: 2.1.0
> Reporter: Jacky Lau
> Assignee: Jacky Lau
> Priority: Major
> Labels: pull-request-available, stale-assigned
> Fix For: 2.3.0
>
>
> Syntax:
> {code:java}
> DATEDIFF(expr1,expr2){code}
> Returns:
> returns _{{expr1}}_ − _{{expr2}}_ expressed as a value in days from one date to the other. _{{expr1}}_ and _{{expr2}}_ are date or date-and-time expressions. Only the date parts of the values are used in the calculation.
> This function returns {{NULL}} if _{{expr1}}_ or _{{expr2}}_ is {{{}NULL{}}}.
> Examples:
> {code:java}
> > SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
> -> 1
> > SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');
> -> -31{code}
> See more:
> * mysql: [https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)