# Time Range Selector

The Time Range Selector is used throughout the applications and supports three different ways of applying the range.

Ways of selecting a time range:&#x20;

1. Date Range (absolute time range selection)
2. Relative selection (using DateMath notation)
3. Quick/Custom selection (predefined relative time ranges)

### DateMath notation

The expression is formed in the following way:

1. Date to be used as an anchor, it can either be `now` or a date string ending with `||`
2. `+` for adding time units to anchor date, `-` for subtracting time units from the anchor date or `\` for rounding the date to the nearest time unit
3. Time unit to be used in the expression. Supported time units are:
   * `y`: Year
   * `Q`: Quarter
   * `M`: Month
   * `w`: Week
   * `d`: Day
   * `h`: Hour
   * `m`: Minute&#x20;
   * `s`: Second
   * `ms`: Millisecond

#### Examples

If `now` is treated as `2025-01-01 12:00:00`,

* `now+1d` &#x20;
  * `now` plus one day. Equals to: `2025-01-02 12:00:00`
* `now-1m` &#x20;
  * `now` minus one minute. Equals to: `2025-01-01 11:59:00`
* `now-1s/h` &#x20;
  * `now` minus one second rounded to hours. Equals to: `2025-01-01 11:00:00`
* `2025.01.01||+1M/d` &#x20;
  * `2025.01.01` plus one month rounded to days. Equals to: `2025-02-01 00:00:00`

### Predefined relative time ranges

**Hour**

* This hour&#x20;
  * `now/h - now/h`
* This hour so far
  * `now/h - now`
* Last hour
  * `now-1h/h - now-1h/h`
* Last 1h&#x20;
  * `now-1h - now`
* Last 12h
  * `now-12h - now`
* Last 24h&#x20;
  * `now-24h - now`
* Last 48h
  * `now-48h - now`

**Day**

* Today
  * `now/d - now/d`
* Today so far
  * `now/d - now`
* Yesterday
  * `now-1d/d - now-1d/d`
* This day last week
  * `now-7d/d - now-7d/d`
* Last 7 days
  * `now-7d - now`
* Last 30 days
  * `now-30d - now`
* Last 90 days
  * `now-90d - now`

**Week**

* This week
  * `now/w - now/w`
* This week so far
  * `now/w - now`
* Previous week
  * `now-1w/w - now-1w/w`

**Month**

* This month
  * `now/M - now/M`
* This month so far
  * `now/M - now`
* Previous month
  * `now-1M/M - now-1M/M`
* Last 6 months
  * `now-6M - now`

**Quarter**

* This quarter
  * `now/Q - now/Q`
* This quarter so far
  * `now/Q - now`
* Previous quarter
  * `now-1Q/Q - now-1Q/Q`

**Year**

* This year
  * `now/y - now/y`
* This year so far
  * `now/y - now`
* Previous year
  * `now-1y/y - now-1y/y`
* Last 1 year
  * `now-1y - now`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akenza.io/akenza.io/general/time-range-selector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
