pgsql 獲取 當前日期 上月第一天和最后一天
關于pgsql的語法,有啥推薦的書嗎?要中文的,謝謝。
uj5u.com熱心網友回復:
你參考一下:當前日期的當月第一天 : date_trunc('month', current_date)
日期的增減: current_date - interval '1 day' -- 當前日期的前一天
current_date - interval '1 month' -- 當前日期的上月這天
當月的最后一天 = 下月的第一天 - 1天
uj5u.com熱心網友回復:
http://www.postgres.cn/index.php/v2/homepostgresql 中文網站, 看一下幫助檔案
uj5u.com熱心網友回復:
select current_date as 當前日期,date_trunc('month',current_date) as 當月第一天
,date_trunc('year',current_date) as 當年的第一天
,date_trunc('month',current_date)-interval'1months' as 上個月的第一天
,date_trunc('month',current_date)-interval'1days' as 上個月日最后一天
uj5u.com熱心網友回復:
謝謝各位!!轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/43448.html
標籤:PostgreSQL
