jackylau created FLINK-28929: -------------------------------- Summary: 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: 1.16.0 Reporter: jackylau Fix For: 1.16.0
Syntax: {code:java} DATEDIFF(expr1,expr2){code} * [{{}}|https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff] [{{}}|https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff] 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|https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_conv] -- This message was sent by Atlassian Jira (v8.20.10#820010)