Relative date
Searching on a date (e.g. a creation date or reservation date) is often used within filters. The search is often based on a specific date (e.g. all reservations for today). The disadvantage of this is that as a user you have to enter today's date every day to obtain the correct information from the system.
To make this easier, there is the option to use "relative data". Relative means "compared to". A relative date is a calculated date compared to today. To calculate the relative date, minutes, days, hours and weeks can be used, lying before or after today's date. When searching, there are two types of fields: date fields (such as the reservation from date) and date-time fields (such as the "Created" and "Updated" fields). With a date field, only days are compared. For date-time fields on day and time components. In concrete terms, a number of fixed values for date fields:
- -2d means "The day before yesterday"
- -1d means "Yesterday"
- 0d means "Today"
- 1d means "Tomorrow"
- 2d means "The day after tomorrow"
Example
Assuming a filter based on all reservations today.
A relative date would then be "started >= 0d" (counting today) and "started <= 0d" (counting today)
Assuming a filter based on all reservations for tomorrow.
A relative datum would then be >= 1d and <= 1d.
Assuming a filter based on all reservations for the 7 days, including today.
A relative date would then be 0d (including today) and 7d (7 days ahead from today's date)
Assuming a filter based on all reservations for the 4 weeks, excluding this week.
A relative date would then be 1w (shows reservations after 1 week from today's date) and 4w (up to 4 weeks ahead from today's date)
Assuming a filter based on new customers who signed up in the last 12 hours.
A relative date would then be -12h (12 hours back from today) and 0d (including today until 00:00 the next day)
If we want to provide this example via the simple search screen, we use the "MORE" button behind the relative date.
The table below shows the various codes that can be used to specify relative values. These are also described in the simple search screen.
Code | Meaning |
---|---|
m | Minutes |
h | Hour |
d | Day |
w | Week |