Returns true iff p1
starts before p2
starts and ends after p2
ends.
-
contains?
:p1-start <= p2-start
,p1-end >= p2-end
-
strictly-contains?
:p1-start < p2-start
,p1-end > p2-end
Note
|
For information on what temporal types we support and how to construct temporal literals, see temporal types. |
XTQL | SQL | Return type |
---|---|---|
|
|
date-time |
|
|
duration |
|
|
interval |
|
|
date-time |
|
|
duration |
|
|
interval |
|
|
integer (number of days elapsed) |
|
|
duration |
|
|
interval |
|
|
duration |
|
|
interval |
|
|
duration |
|
|
interval |
Note
|
|
XTDB allows fine-grained control over user requests for the 'current time', to allow for fully repeatable queries.
The wall-clock time of a query is fixed when the query starts.
It can be explicitly specified by passing :current-time
to the query options; otherwise, it will snapshot the current-time of the XTDB node.
The wall-clock time of a query within a transaction is fixed to the system-time of the transaction, as recorded by the transaction log (or overridden using the :system-time
option to submit-tx
).
Each transaction/query has a default time-zone, which defaults to the time-zone of the XTDB node’s JVM unless overridden in the query options (default-tz
).
XTQL | SQL | |
---|---|---|
|
|
Returns the current wall-clock date/time as a timestamp with time-zone. |
|
|
Returns the current UTC wall-clock date. |
|
|
Returns the current UTC wall-clock time. |
|
|
Returns the current wall-clock date/time as a local timestamp (without time-zone), as in the query’s time-zone. |
|
|
Returns the current wall-clock time as a local time (without time-zone), as in the query’s time-zone. |
Periods in XTDB are represented as a struct with a :start
and :end
timestamp.
Most of these period comparators have 'strictly' and 'immediate' variants.
'strictly' variants check that the two periods don’t meet - e.g. precedes?
will return true if the earlier period ends at the same time the second period starts; strictly-precedes?
will return false.
'immediately' variants check that the two periods do meet.
These functions will return null if any of their arguments are null.
XTQL | SQL | |
---|---|---|
|
|
Returns true iff
|
|
|
Returns true iff the two periods are equal
|
|
|
Returns true iff
|
|
|
Returns true iff
|
|
|
Returns true iff
|
|
|
Returns true iff
|
|
|
Returns true iff
|
XTQL |
SQL |
|
|
|
Truncates the date-time to the given time-unit, which must be one of |
|
|
Truncates a timezone aware date-time to the given time-unit, which must be one of |
|
|
Truncates the given interval to the given time-unit, which must be one of |
|
|
Extracts the given field from the date-time. Field must be one of |
|
|
Extracts the given field from the date. Field must be one of |
|
|
Extracts the given field from the time. Field must be one of |
|
|
Extracts the given field from the interval. Field must be one of |
|
|
Returns an interval representing the difference between two date-times - subtracting the second value from the first. Works for any combination of date times, date times with time zone identifiers, or dates. |