QuasarDB supports different ways to express timestamps which are discussed in this chapter.

Defines an absolute point in time. This can be either a date, or a date + time. When a time is not provided, assumes 12 AM (midnight).

In addition to this, there are convenience functions for representions relative to the current point in time: `now()`

, `today()`

, `yesterday()`

and `tomorrow()`

(parentheses are optional).

Examples:

`now`

Represents the current point in time, rounded by the second.

`today`

Represents the current day, truncated by the day. For example, assuming the current time is 3pm on January 2, 2018, this will represent 12AM on January 2, 2018.

`yesterday`

Represents one day before the current day, truncated by the day. For example, assuming the current time is 3pm on January 2, 2018, this will represent 12AM on January 1, 2018.

`tomorrow`

Represents one day after the current day, truncated by the day. For example, assuming the current time is 3pm on January 2, 2018, this will represent 12AM on January 3, 2018.

`epoch`

Represents the earliest representable date.

`end_of_time`

Represents the latest representable date.

`2018-01-01`

Represents the first of January 2018.

`2018-01-01T03:00:00`

Represents 3AM on the first of January 2018.

`2018-01-01T03:00:00.000000001Z`

Represents 1 nanosecond past 3AM on the first of January 2018.

Defines a duration of time. Typical use cases include `TIMESTAMP`

calculations in expressions, defining relative offsets for a `RANGE`

, or specifying time intervals for `GROUP BY`

.

Valid durations are:

`1ns`

,`1nanosecond`

:A delta of one nanosecond.

`1us`

,`1microsecond`

:A delta of one microsecond.

`1ms`

,`1millisecond`

:A delta of one millisecond.

`1s`

,`1second`

:A delta of one second.

`1min`

,`1minute`

:A delta of one minute.

`1h`

,`1hour`

:A delta of one hour.

`1d`

,`1day`

:A delta of one day.

`1w`

,`1week`

:A delta of one week.

`1mon`

,`1month`

:A delta of one month.

`1y`

,`1year`

:A delta of one year.

`1y 2mon 3w 4d 5h 6min 7s 8ms 9us 10ns`

:A delta of 1 year, 2 months, 3 weeks, 4 days, 5 hours, etc.

Defines a time offset relative to another absolute point in time. Typical use cases include performing calculations on `TIMESTAMP`

columns or defining a `RANGE`

.

An offset requires a duration and a sign (positive or negative) to be specified.

An example relative timerange for 2 weeks after the absolute timestamp:

```
+2w
```

An example relative timerange 30 minutes before the absolute timestamp:

```
-30min
```