Datediff Minute Postgres

[Solved] Datediff Minute Postgres | Sql - Code Explorer | yomemimo.com
Question : DATEDIFF minute postgres

Answered by : matteo-puppis

 -- Difference between Dec 30, 2011 08:54:55 and Dec 30, 2011 08:56:10 in minutes SELECT (DATE_PART('day', '2011-12-30 08:56:10'::timestamp - '2011-12-30 08:54:55'::timestamp) * 24 * 60 + DATE_PART('hour', '2011-12-30 08:56:10'::timestamp - '2011-12-30 08:54:55'::timestamp)) * 60 + DATE_PART('minute', '2011-12-30 08:56:10'::timestamp - '2011-12-30 08:54:55'::timestamp); -- Result: 1
  -- Time only SELECT DATE_PART('hour', '08:56:10'::time - '08:54:55'::time) * 60 + DATE_PART('minute', '08:56:10'::time - '08:54:55'::time); -- Result: 1

Source : http://www.sqlines.com/postgresql/how-to/datediff | Last Update : Tue, 03 Mar 20

Answers related to datediff minute postgres

Code Explorer Popular Question For Sql