2020
12-29
12-29
postgresql 获取两个时间类型小时差值案例
我就废话不多说了,看代码吧~selectextract(dayfromt)*24+extract(hourfromt)from(select(timestamp'2013-12-1412:00:00'-timestamp'2013-12-114:00:00')ast)asa;例如a表中有start,end俩字段selectextract(dayfrom(end-start))*24+extract(hourfrom(end-start))froma补充:PostgreSQL得出两个timestamp的秒数差值sql语句SELECTEXTRACT(EPOCHFROM(TIMESTAMP'2017-12-1612:21:13'-TIMESTAMP...
继续阅读 >