postgreSQL中参数的时区数据类型如何从时间戳中获取时间

postgreSQL中参数的时区数据类型如何从时间戳中获取时间,postgresql,Postgresql,嗨,我有一个2个参数,是没有时区数据类型的时间戳,我正在计算这2个参数的时钟输出时间和时钟输入时间 这是我的功能 (select EXTRACT ( hour from (select sum( att.clock_out_time - att.clock_in_time) from public."VOfficeApp_employee_attendence" att where att.user_id = 2017

嗨,我有一个2个参数,是没有时区数据类型的时间戳,我正在计算这2个参数的时钟输出时间和时钟输入时间

这是我的功能

(select EXTRACT ( hour from (select sum( att.clock_out_time - att.clock_in_time) 
            from public."VOfficeApp_employee_attendence" att
            where att.user_id = 2017
            and att.company_id =391 
            and date_part('month', date) = 4)))
输出: "24" 我要找的是: “24:38:30.084”

事实上我必须把这几天转换成时间我怎么能转换呢

29 days 24:38:30.084

从时间戳中减去时间戳的结果是
间隔。您可以使用


请注意,不需要进行外部选择:

select extract(hour from sum(att.clock_out_time - att.clock_in_time)) 
from public."VOfficeApp_employee_attendence" att
where att.user_id = 2017
  and att.company_id =391 
  and date_part('month', date) = 4)
select extract(hour from sum(att.clock_out_time - att.clock_in_time)) 
from public."VOfficeApp_employee_attendence" att
where att.user_id = 2017
  and att.company_id =391 
  and date_part('month', date) = 4)