Timestamp comparison
Operators
Timestamps represent the absolute position in time of two events. They can be compared to check if a timestamp is equal to another, greater (or equal) than another, or lesser (or equal) than another.
Concretely, timestamp comparison operations involve using the usual comparison operators (like <
, >
) to determine the relationship between two values. For example:
timestamp_1 < timestamp_2
: True iftimestamp_1
is beforetimestamp_2
.timestamp_1 > timestamp_2
: True iftimestamp_1
is aftertimestamp_2
.
Valid conditions must evaluate to true
or false
, so you cannot add or subtract timestamp values (timestamp_1 - timestamp_2
is not valid), though you can use the date function to shift a timestamp by a duration.
Examples
- Check if
updated_at
falls within the past 7 days
Updated 6 months ago