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

Add functions DT_DATE_NOW and DT_DATE_TODAY #453

Merged
merged 6 commits into from
Apr 1, 2024

Conversation

oswaldobapvicjr
Copy link
Contributor

This PR introduces new DATE_TIME functions:

DT_DATE_NOW

Produces a new DATE_TIME that represents the current date and time.

It is useful to calculate a value based on the current date and time. For example, if you know the start DATE_TIME of a running process, you might use the following expression to find the DURATION that represents the process age:

DT_DATE_NOW() - startDateTime

DT_DATE_TODAY

Produces a new DATE_TIME that represents the current date, at midnight (00:00), in the system default time zone.

It is useful for DATE_TIME comparison when the current time must not be considered. For example, in the expression:

IF(expiryDate > DT_DATE_TODAY(), "expired", "valid")

NOTE: The functions and examples were inspired by well-accepted spreadsheet systems.

Copy link
Collaborator

@uklimaschewski uklimaschewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, good idea, but I would like to have some changes before I can merge this.

docs/references/functions.md Outdated Show resolved Hide resolved
docs/references/functions.md Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Apr 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Collaborator

@uklimaschewski uklimaschewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes required, I will add another PR myself to fix them.
E.g. The renaming of DT_NOW/DT_TODAY is not reflected in documentation, also I would like the MIN/MAX functions throw an exception when parameters are missing, as before.

@uklimaschewski uklimaschewski merged commit ac18137 into ezylang:main Apr 1, 2024
2 checks passed
@oswaldobapvicjr oswaldobapvicjr deleted the pr-2 branch April 1, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants