0

I'm new using postgresql and had difficult to convert datetime to bigint type. So my tables has column timecreated that datatype is bigint. I want to get value with range datetime format like dd/mm/yyyy example : select * from mytables where timecreated_at between '01/09/2021' and '10/09/2021' . How i can achieved this?

0

You do not convert datetime to bigint, you use timestamp with time zone. To convert a string to a timestamp with time zone, use the to_timestamp function.

0

Use postgresql timestamp conversion to get the range in days like

SELECT DATE_PART('day', '2021-09-10 00:00:00'::timestamp - '2021-09-01 00:00:00'::timestamp) as days;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.