博客
关于我
Postgresql 日期和时间类型
阅读量:387 次
发布时间:2019-03-05

本文共 1693 字,大约阅读时间需要 5 分钟。

PostgreSQL???????????????????

?PostgreSQL?????????????????????????????????????????????????????????

???????

PostgreSQL ??????????????????????????????????????????????????????????????????????????????????????????????

1. ??????????

???????????????????

  • CURRENT_DATE???????????????
  • CURRENT_TIME???????????????
  • CURRENT_TIMESTAMP???????????
  • CURRENT_TIME(precision)?????????????
  • LOCALTIME?????????????????
  • LOCALTIMESTAMP?????????????????????????

???????????????????????????????????

2. ??????????

???????????????????

  • now()????????????????????
  • timeofday()???????????????????
  • statement_timestamp()????????????????

??????????????????????????????????????

???????

??????????????????

highgo=# begin;BEGINhighgo=# select now(); now------------2023-10-18 14:22:45.678901+08:00 (1 row)highgo=# select statement_timestamp();statement_timestamp------------2023-10-18 14:22:47.890123+08:00 (1 row)

??????????? now() ? statement_timestamp() ???????????now() ????????????????? statement_timestamp() ????????????????

????????

????????????PostgreSQL ?????????????????????????

highgo=# create table t(date date);CREATE TABLEhighgo=# insert into t values (date '2023-10-18');INSERT 0 1

?????????????????????????

highgo=# insert into t values (timestamp '2023-10-18 14:22:45.678901+08:00');INSERT 0 1

???????PostgreSQL???????? ISO, MDY?????????????????????

highgo=# set datestyle = 'YMD';

???????

????????????????????????

highgo=# select time '12:09:00.123456';time---------12:09:00.123456 (1 row)

???????MySQL ????????? PostgreSQL ????????

??

? PostgreSQL ???????????????????????????????????????????????????????? CURRENT_TIMESTAMP ? LOCALTIMESTAMP?????????????????? now() ? timeofday()?

???????????????????????????????????

转载地址:http://qcowz.baihongyu.com/

你可能感兴趣的文章
nginx 后端获取真实ip
查看>>
Nginx 学习总结(17)—— 8 个免费开源 Nginx 管理系统,轻松管理 Nginx 站点配置
查看>>
nginx 常用配置记录
查看>>
Nginx 我们必须知道的那些事
查看>>
Nginx 的 proxy_pass 使用简介
查看>>
Nginx 的配置文件中的 keepalive 介绍
查看>>
Nginx 负载均衡与权重配置解析
查看>>
Nginx 负载均衡详解
查看>>
nginx 配置 单页面应用的解决方案
查看>>
nginx 配置https(一)—— 自签名证书
查看>>
nginx 配置~~~本身就是一个静态资源的服务器
查看>>
Nginx 配置解析:从基础到高级应用指南
查看>>
Nginx下配置codeigniter框架方法
查看>>
nginx添加模块与https支持
查看>>
Nginx用户认证
查看>>
Nginx的Rewrite正则表达式,匹配非某单词
查看>>
Nginx的使用总结(一)
查看>>
Nginx的可视化神器nginx-gui的下载配置和使用
查看>>
Nginx的是什么?干什么用的?
查看>>
Nginx访问控制_登陆权限的控制(http_auth_basic_module)
查看>>