1.to_timestamp:
1AND to_timestamp(a.upload_time,’yyyy-MM-dd’)>='”+startTime+”‘ and to_timestamp(a.upload_time,’yyyy-MM-dd’) <= ‘”+endTime+”‘
2.substring:
1substring(‘2019-04-08 14:18:09’,index,k):
数值代表含义 index:代表从index开始截取数据 , k代表从index开始截取到第k个数据
处理对象:时间为字符串格式的数据
eg:
截取时间到 年-月-日:
1SELECT substring(upload_time,1,10) from table WHERE upload_time=’2019-04-08 14:18:09′
结果:2019-04-08
截取时间到 时:分:
1SELECT substring(upload_time,12,5) from table WHERE upload_time=’2019-04-08 14:18:09′
结果:14:18
文章来源:脚本之家
来源地址:https://www.jb51.net/article/205167.htm
【PostgreSQL 字符串处理与日期处理操作】申请创业报道 , 分享创业好点子 。 , 共同探讨创业新机遇!
- PostgreSQL字符切割:substring函数的用法说明
- postgresql 中的to_char常用操作
- postgresql 中position函数的性能详解
- PostGreSql 判断字符串中是否有中文的案例
- 介绍胎儿生长受限的诊断及处理方法
- 尾气超标12123能查出来吗?尾气不合格要多少钱处理
- 如何处理电脑开机出现英文字母
- 榴莲不够熟怎么处理优质
- 发动机过热怎么处理?发动机过热还能开多远
- 分娩险情处理