--- title: "Relative Date-Time" slug: "relative-date-time" updated: 2026-03-23T23:27:28Z published: 2026-03-23T23:27:28Z canonical: "docs.imat.io/relative-date-time" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.imat.io/llms.txt > Use this file to discover all available pages before exploring further. # Relative Date-Time Note:This document builds on the date-time principles introduced in the **Query Syntax** guide. The query term for a date-time interval supports date delta expressions whenever the begin date-time or the end date-time uses the keyword TODAY or NOW. It is awkward for the user to write a different fixed date-time interval each time he wants to query over the last 30 days, for example: ```none service_date:[2015-10-06 TO 2015-11-05] ``` He may now write a relative date-time expression to cover a date-time interval relative to the current date (or date-time), eliminating the need to change the dates in the query each time he runs the report. To do so, a pivot term (fixed term) and a delta term (the increment from the pivot term) are required. --- ## Delta Operators The delta refers to the date or time as it revolves around the pivot term. It is possible to use either a positive or a negative term in the search. Below is a list of operators used to increment or decrement the date or time: - **±1s**: second - **±1mi**: minute - **±1h**: hour - **±1d**: day - **±1w**: week - **±1mo**: month - **±1q**: quarter - **±1y**: year By convention, the start of the week is Sunday. To increment or decrement more than one unit, enter the appropriate number instead of 1. For exactly one unit, the 1 is optional. The following queries over the last 30 days: ```none service_date:[TODAY-30d TO TODAY] ``` Note:When using the plus sign, +, in a browser's URL line, it expects HTTP CGI encoding. This means that the + symbol must be percent encoded as `%2B`; otherwise, it gets converted to a blank. However, when entering data into the code section of Report Builder, the software typically does the percent encoding, and the + can be entered as +. --- ## Pivot Term The keyword TODAY refers to the current date. The keyword NOW refers to the current date-time (accurate to the nearest second). Time zones used for reference points depend on which version you are using. - Version 8.x and earlier: the server's local time zone - Version 9.x and beyond: UTC time As a convenience, either keyword, TODAY or NOW, only needs to appear in one term of the query, but one of the keywords must appear in at least one term. The other term may be a pure date delta expression. The two examples below yield the same results: ```none service_date:[-30d TO TODAY] ``` ```none service_date:[TODAY-30d TO TODAY] ``` As long as one term resolves to an absolute date-time, known as the "pivot," the other term is computed from the pivot value. You can use pivot terms when searching for a single date. The following returns all records that were indexed the prior day: ``` indextime:[TODAY-1d] ``` Here, the ending date is the day before the query was executed, and the start date is 30 days before that. The pivot is TODAY minus one day (yesterday). The start date is the pivot value minus 30 days. ``` service_date:[-30d TO TODAY-1d] ``` The pivot can be in the start term: ``` appointment_date:[TODAY+d TO 30d] ``` Note that the "1" was optional in this example: "+d" is the same as "+1d." Also, the lead "+" was inferred for "30d" (same as "+30d"). The example indicates tomorrow is the pivot (TODAY plus one day), and the end date is tomorrow plus thirty days. Note:Use caution when using TODAY or NOW as the start term and using a future date or time for the ending term. Historical cases require a backward search rather than a forward one. --- ## Date Delta with Absolute Date-time Strings An absolute date string may be entered instead of the word TODAY or NOW. Replacing an absolute date or time performs the same functionality as a pivot term. ```none service_date:[-1mo TO 2026-11-06] ``` ``` service_date:[-1mo TO 20151106] ``` Note:The minus operator, -, can clash with the hyphen in a date string. This can happen if the position of the minus is just after the year: `service_date:[-1y TO 2015-10y]`. The parser treats the hyphen as part of the date string and issues an error message. To correct the ambiguity, enter a space after the year: `service_date:[-1y TO 2015 -10y]`. --- ## Round Down and Round Up Operators The < (round down) and > (round up) symbols are used to round the relative date-time down or up to the boundary indicated by the time unit (minute, hour, day, week, month, quarter or year). The following examples round TODAY down to the beginning of the year, causing 2026-01-01 (given 2026 is the current year) to be the pivot. The start date is one year earlier: 2025-01-01. Rounding always results in a legitimate date. ``` service_date:[-1year TO TODAYmo+2w] ```