Timestamps

Formatting Timestamps

  • Format a timestamp with:
SELECT to_char(now() - '2020-05-28 5:30'::timestamp, 'HH:MI');

DateTime Formatting in Postgres

Convert a timestamp to minutes:

SELECT extract(epoch from (now() - '2020-05-28 5:30'::timestamp)) / 60;