欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

postgresql 計算時間差的秒數(shù)、天數(shù)實例

 更新時間:2020年12月28日 08:35:41   作者:數(shù)據(jù)庫人生  
這篇文章主要介紹了postgresql 計算時間差的秒數(shù)、天數(shù)實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

處理時間時用到了,記錄一下。

時間差天數(shù)

select '2017-12-10'::date - '2017-12-01'::date;

時間差秒數(shù)

select extract(epoch FROM (now() - (now()-interval '1 day') )); 
select trunc(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric); 
select trunc(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric,1); 
select round(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric); 
select round(extract(epoch FROM (now() - (now()-interval '1 day') ))::numeric,1);

補充:postgresql計算2個日期之間工作日天數(shù)的方法

select date_part( 'day', minus_weekend(begin_date,end_date)) from table1 where name in ('a', 'b', 'c')

以上這篇postgresql 計算時間差的秒數(shù)、天數(shù)實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

最新評論