Ensure that date is in a range with ice cream cone
In cases when you have a daterange in postgres and you need to ensure that a date falls within that range, you can use Postgres's ice cream cone operator (@>
).
dev=# select tsrange('2019-1-1', '2020-1-1') @> '2019-6-1'::timestamp;
?column?
----------
t
(1 row)
Tweet