Answer the question
In order to leave comments, you need to log in
How to do the same in PostgreSQL?
Hello. While new to PostgreSQL. Can you tell me how to make such a conversion function?
UNIX_TIMESTAMP(FROM_UNIXTIME(from_at, "%Y-%m-%d 00:00:00")) as date
Answer the question
In order to leave comments, you need to log in
If I understand correctly what you are doing and in from_at you have unix, then you need to do the following:
SELECT EXTRACT(EPOCH FROM to_char(to_timestamp(from_at), 'YYYY-MM-DD 00:00:00')::timestamp);
If you need a UNIXTIME for the start of the day, you can use this option:
select extract(epoch from date_trunc('day', to_timestamp(from_at))) as date;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question