GP数据库中时间函数例子

select to_timestamp(current_timestamp,'yyyy-mm-dd hh24:mi:ss')
2015-11-27 15:40:01+08
select current_timestamp(0)
2015-11-27 15:42:56+08
select current_timestamp(0)::timestamp
2015-11-27 15:43:20
select current_timestamp(0)::timestamp without time zone
2015-11-27 15:43:20


chrg_time :: timestamp <= req_time :: timestamp + interval '2 hour'


'/'字符在client_ua_info字段中的位置
position('/' in client_ua_info) 
instr(a.client_ua_info, '/', 1)

时间正负2小时
a.chrg_time :: timestamp >= b.req_time :: timestamp + interval '-2 hour'  GP:数据类型字符串
(to_number(a.chrg_time - b.req_time) * 24 between - 2 and 2 )  oracle:数据类型date 

select to_date('2015/09/18 13:57:05','yyyy/mm/dd hh24:mi:ss')   --GP:2015-09-18 
select to_date('2015/9/20 10:23:22','yyyy/mm/dd hh24:mi:ss') from dual  --oracle:2015/9/20 10:23:22



你可能感兴趣的:(Python开发,GP开发基础)