PostgreSQL获取本月第一天时间戳等信息
PostgreSQL大约 573 字date_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);
阅读 66 · 发布于 2020-12-16
————        END        ————
扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看换一批
- Linux使用dstat性能监测阅读 412
- MongoDB提示None of the hosts for replica set could be contacted阅读 205
- MySQL查看配置文件路径阅读 493
- Linux之Ubuntu apt-get更换镜像阅读 861
- 设计模式之桥接模式阅读 594
- 算法每日一题20190622:罗马数字转整数阅读 467
- 软考-系统架构设计师:云计算阅读 366
- Nginx配置之worker_processes阅读 557
- Redis实现统计在线人数、每日签到功能阅读 1890
- Spring Boot logback springProperty设置默认值阅读 98