Table Of Contents

6.5. Timestamps

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

6.5.1. Absolute

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(), yesterday() and tomorrow() (parentheses are optional).

Examples:

now
Represents the current point in time, rounded by the second.
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.

6.5.2. Durations

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 1 second durations are:

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.

6.5.3. Offsets

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
arrow_backPrevious
6.4. Select
Next arrow_forward
6.6. Function & Operators