I am working on a spring api where I am using postgres and saving a field of type timestamp with field name as created_date
. Now I want to check whether this field is between two different timestamps.
Right now I am using this:
JavaScript
x
select *
from your_table
where created_date >= '2020-06-22 19:10:25-07'
and created_date < '2020-06-23 19:10:25-07'
Is there a way I can use BETWEEN
here for this operation?
Advertisement
Answer
You can do it like this:
JavaScript
SELECT *
FROM your_table
WHERE created_date BETWEEN '2020-06-22 19:10:25-07'
AND '2020-06-23 19:10:25-07'
If you want to do it using JDBC, check this answer and this answer.