ezylang / EvalEx

EvalEx is a handy expression evaluator for Java, that allows to evaluate simple mathematical and boolean expressions.
https://ezylang.github.io/EvalEx/
Apache License 2.0
980 stars 266 forks source link

Add functions DT_DATE_NOW and DT_DATE_TODAY #453

Closed oswaldobapvicjr closed 5 months ago

oswaldobapvicjr commented 5 months ago

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.

sonarcloud[bot] commented 5 months ago

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