PostgreSQL 获取本月第一天时间戳等信息
PostgreSQL About 577 wordsdate_trunc
日期函数中适用的时间字段
second
minute
day
hour
day
week
month
quarter
year
当天零点
select date_trunc('day', current_date);
本周第一天
select date_trunc('week', current_date);
本月第一天
select date_trunc('month', current_date);
上个月最后一天
select date_trunc('month', current_date) - interval'1 day';
本月最后一天
select date_trunc('month', current_date) + interval'1 month - 1 day';
本季度第一天
select date_trunc('quarter', current_date);
本季度第15天 15小时 15分 30秒
select date_trunc('quarter', current_date) + interval '15 day 15 hour 15 minute 30 second';
今年第一天
select date_trunc('year', current_date);
Views: 6,493 · Posted: 2020-12-16
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓

Loading...