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][SDK] Transform SQL supports TIMESTAMPDIFF function #11152

Open
2 tasks done
Zkplo opened this issue Sep 20, 2024 · 0 comments · May be fixed by #11160
Open
2 tasks done

[Feature][SDK] Transform SQL supports TIMESTAMPDIFF function #11152

Zkplo opened this issue Sep 20, 2024 · 0 comments · May be fixed by #11160
Assignees
Milestone

Comments

@Zkplo
Copy link
Contributor

Zkplo commented Sep 20, 2024

Description

TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2): Returns datetime_expr2 − datetime_expr1, where datetime_expr1 and datetime_expr2 are date or datetime expressions. One expression may be a date and the other a datetime; a date value is treated as a datetime having the time part '00:00:00' where necessary. This function returns NULL if datetime_expr1 or datetime_expr2 is NULL.

The unit parameter should be one of the following values: MICROSECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR

Use case

TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01'); -> 3
TIMESTAMPDIFF(YEAR,'2002-05-01','2001-01-01'); -> -1
TIMESTAMPDIFF(MINUTE,'2003-02-01','2003-05-01 12:05:55');  -> 128885
TIMESTAMPDIFF(MINUTE,null,'2003-05-01 12:05:55');  -> null

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@Zkplo Zkplo linked a pull request Sep 20, 2024 that will close this issue
3 tasks
@dockerzhang dockerzhang added this to the 1.14.0 milestone Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants