# `Ecto.DateTimeRange`
[🔗](https://github.com/synchronal/ecto_date_time_range/blob/main/lib/ecto/date_time_range.ex#L1)

`Ecto.DateTimeRange` provides modules implementing `Ecto.Type` to allow
usage of Postgres range times encoding timestamp ranges.

# `sigil_t`

Create an `Ecto.UTCDateTimeRange` from two ISO8601 strings.

## Example

```
iex> import Ecto.DateTimeRange, only: [sigil_t: 2]
...>
iex> ~t(2020-02-02T00:01:00Z..2020-02-02T00:01:01Z)
%Ecto.DateTimeRange.UTCDateTime{start_at: ~U[2020-02-02T00:01:00Z], end_at: ~U[2020-02-02T00:01:01Z]}
...>
iex> ~t(2020-02-02T00:01:00Z..2020-02-02T00:01:01Z)U
%Ecto.DateTimeRange.UTCDateTime{start_at: ~U[2020-02-02T00:01:00Z], end_at: ~U[2020-02-02T00:01:01Z]}
...>
iex> ~t(2020-02-02T00:01:00..2020-02-02T00:01:01)N
%Ecto.DateTimeRange.NaiveDateTime{start_at: ~N[2020-02-02T00:01:00], end_at: ~N[2020-02-02T00:01:01]}
...>
iex> ~t(00:01:00..00:01:01)T
%Ecto.DateTimeRange.Time{start_at: ~T[00:01:00], end_at: ~T[00:01:01]}
...>
iex> ~t(hi there)
** (ArgumentError) Unable to parse DateTime(s) from input
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
