Home > Net >  How to convert days to minutes
How to convert days to minutes

Time:03-08

Need to convert the output from below to minutes:

example query:

SELECT 
  avg(date - create_date)
FROM x

example outputs - need to be converted into minutes:

20 days 24:22:59.328877
1 day 16:30:18.131138
5 days 16:46:54.355619

CodePudding user response:

Extract epoch to get seconds, then divide by 60:

select
    extract(epoch from avg(date - create_date)) / 60 as avg_minutes
  • Related