postgsql 时间函数
来源:互联网 发布:用php写99乘法表 编辑:程序博客网 时间:2024/06/11 19:11
https://www.postgresql.org/docs/9.2/static/functions-datetime.html
时间获取
获取当前完整时间
select now();或select current_timestamp;
获取当前日期
select current_date;
获取当前时间
select current_time;
时间计算
一年后
select now() + interval '1 year';
两月前
select now() - interval '2 month';
三周前
select now() - interval '3 week';
4小时后
select current_timestamp + interval '4 hour';
5分钟前
select current_timestamp - interval '5 min';
时间差函数
age(timestamp, timestamp)
时间字段的截取
EXTRACT(field FROM source)例如:select extract(year from now());select extract(month from now());查看今天是一年中的第几天select extract(doy from now());
0 0
- postgsql 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- 时间函数
- DOM (文档对象模型(Document Object Model))
- js小功能:定时器之滑动的ul
- 空闲时间学一个Linux命令(16)—— which命令
- Android 动画--> 图片切换效果
- c++,vector的[]和at区别
- postgsql 时间函数
- shell中$0,$?,$!等的特殊用法
- 一次性添加多个字段
- js小效果:上移和下移!
- Linux如何查看进程、杀死进程、启动进程等常用命令
- 从GITLAB误删除数据库想到的
- 17/2/3/ 兄弟郊游问题
- 【t013】无聊的军官
- poj 1789 Truck History(prim)