EQL date and time functions
EntityModule provides an extensive list of EQL functions
to handle the specification of dates and times.
The creation of all date and times you need for filtering can be facilitated by providing the necessary date and time specifications to these functions.
These functions will use your Locale.default()
to determine daylight saving time and the day the week start at.
You can set up your Locale by setting the spring.mvc.locale
property in you application property file.
Default EQL date and time functions
The following EQL functions
are provided by default:
Function | Output |
---|---|
now(x) |
Current date & time |
today(x) |
The current day at midnight |
monday(x) |
The previous monday at midnight. If the current day is monday, the output will be equal to the current day at midnight. |
tuesday(x) |
The previous tuesday at midnight. If the current day is tuesday, the output will be equal to the current day at midnight. |
wednesday(x) |
The previous wednesday at midnight. If the current day is wednesday, the output will be equal to the current day at midnight. |
thursday(x) |
The previous thursday at midnight. If the current day is thursday, the output will be equal to the current day at midnight. |
friday(x) |
The previous friday at midnight. If the current day is friday, the output will be equal to the current day at midnight. |
saturday(x) |
The previous saturday at midnight. If the current day is saturday, the output will be equal to the current day at midnight. |
sunday(x) |
The previous sunday at midnight. If the current day is sunday, the output will be equal to the current day at midnight. |
day(x) |
The current day at midnight. |
week(x, dayOfTheWeek) |
First day of the current week at midnight without parameters.
Uses the |
weekNumber(x) |
The current weekNumber |
month(x, month) |
First day of the current month at midnight.
You can provided an option month parameter ("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER", "DECEMBER")
For example |
year(x) |
First day of the current year at midnight. |
All possible values for x can be found in the Date and time specifications chapter.
You have to use the now() function to include the current time.
The rest of the functions will reset the time to midnight for convenience.
|
Date and time specifications
Each function accepts one or more date and time specifications that can alter the date/time used.
The date and time specifications are represented by an integer followed by (one or more) characters starting with a case-sensitive date and time specification
.
The possible date and time specifications
are:
Parameter | Date and time specification starting character | Example |
---|---|---|
Seconds |
s or S |
The next second: |
Minutes |
m |
Five minutes ago: |
Hours |
h or H |
Four hours and 15 minutes ago: |
Days |
d or D |
Tomorrow at midnight: |
Weeks |
w or W |
First day of the next week at midnight: |
Months |
M |
First day of next month at midnight: |
Years |
y or Y |
Second day of the previous year |
It is possible to customize the date and time specifications by adding your own mapping. |
Examples
Some more examples:
Description | EQL function |
---|---|
Start of week |
|
Exactly one week ago (including time) |
|
Exactly one week ago (not including time) |
|
Two weeks, 3 days and 50 minutes ago |
|
Two weeks, 3 days and 50 minutes ago (Full text) |
|
Monday of next week |
|