> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seltz.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter by date

> How to limit search results to a date range using supported SDKs or REST.

`from_date` and `to_date` bound results by publication date. Either can be an absolute date or an offset from now, and you can pass one or both.

An absolute bound is a date, `2025-10-28`, or a datetime, `2025-10-28T23:00:00Z`. A relative bound is `now`, or `now-` and one duration, such as `now-7d` for the past week.

| Unit | Meaning            |
| ---- | ------------------ |
| `s`  | second             |
| `m`  | minute             |
| `h`  | hour               |
| `d`  | 24 hours           |
| `w`  | 7 days             |
| `M`  | one calendar month |
| `y`  | one calendar year  |

A count and a unit are both required, and case matters: `m` is minutes, `M` is months.

<Note>
  Times are UTC. A date with no time starts that day on `from_date` and covers the whole of it on `to_date`.

  `M` and `y` step the calendar rather than a fixed number of seconds, and clamp the day to the length of the target month, so `now-1M` from 31 March lands on 28 or 29 February.
</Note>

The examples below return results published in the past week.

<CodeGroup>
  ```python Python theme={null}
  from seltz import Seltz

  client = Seltz()

  response = client.search("ai search funding", from_date="now-7d")

  for doc in response.documents:
      print(f"- {doc.url}")
  ```

  ```typescript TypeScript theme={null}
  import { Seltz } from "seltz"

  const client = new Seltz();
  const result = await client.search({ query: "ai search funding", fromDate: "now-7d" });

  for (const doc of result.documents) {
    console.log(doc.url);
  }
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.seltz.ai/v1/search \
    -H "x-api-key: $SELTZ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "ai search funding", "from_date": "now-7d"}'
  ```
</CodeGroup>

<Note>
  A date filter narrows what is returned. It does not promise that anything published in the window has been indexed yet, so a window of an hour or two can come back empty.
</Note>
