# Consultas por tiempo

## Diferentes unidades de tiempo

| Unidad de tiempo | Abreviatura | Ejemplo de uso en consulta   | ¿Soportado en InfluxQL? | Descripción       |
| ---------------- | ----------- | ---------------------------- | ----------------------- | ----------------- |
| Nanosegundos     | ns          | `WHERE time > now() - 500ns` | Sí                      | 500 nanosegundos  |
| Microsegundos    | u, µ        | `WHERE time > now() - 10u`   | Sí                      | 10 microsegundos  |
| Milisegundos     | ms          | `WHERE time > now() - 100ms` | Sí                      | 100 milisegundos  |
| Segundos         | s           | `WHERE time > now() - 30s`   | Sí                      | 30 segundos       |
| Minutos          | m           | `WHERE time > now() - 15m`   | Sí                      | 15 minutos        |
| Horas            | h           | `WHERE time > now() - 2h`    | Sí                      | 2 horas           |
| Días             | d           | `WHERE time > now() - 1d`    | Sí                      | 1 día             |
| Semanas          | w           | `WHERE time > now() - 3w`    | Sí                      | 3 semanas         |
| Meses            | —           | —                            | **No**                  | No está soportado |
| Años             | —           | —                            | **No**                  | No está soportado |

## Diferentes formas de consulta por tiempo

| Forma de consulta              | Ejemplo                                                                  | Descripción                                                                                |
| ------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| Filtro por tiempo absoluto     | `WHERE time >= '2025-06-01T00:00:00Z' AND time < '2025-06-02T00:00:00Z'` | Selecciona datos entre fechas/horas específicas.                                           |
| Filtro por tiempo relativo     | `WHERE time > now() - 1h`                                                | Selecciona datos relativos al momento actual (última hora, día, semana, etc.).             |
| Agrupación por intervalos      | `GROUP BY time(10m)`                                                     | Agrupa datos en ventanas de tiempo regulares (ej: cada 10 minutos).                        |
| Ajuste de zona horaria         | `tz('Europe/Madrid')`                                                    | Ajusta la zona horaria de los resultados de la consulta.                                   |
| Cambio de formato de timestamp | `precision rfc3339`                                                      | Cambia el formato de las marcas de tiempo devueltas por la consulta (ej: legible o epoch). |


---

# 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://darioaplicano.gitbook.io/influxdb2.x/sesion-2/guion-de-la-sesion/documentacion/lenguaje-de-consultas-en-influxdb/influxql/consultas-por-tiempo.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.
