Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

        
AI编程,程序员挑战年入30~100万高级指南 - 职业规划
SpringBoot+SpringSecurity+Vue权限系统高级实战课程        

IDEA永久激活

Java微信小程序电商实战课程(SpringBoot+VUe)

     

AI人工智能学习大礼包

     

PyCharm永久激活

66套java实战课程无套路领取

     

Cursor+Claude AI编程 1天快速上手视频教程

     

greenplum使用手册 PDF 下载


时间:2020-10-10 10:46来源:http://www.java1234.com 作者:转载  侵权举报
greenplum使用手册 PDF 下载
失效链接处理
greenplum使用手册 PDF 下载

本站整理下载:
提取码:y4bg 
 
 
相关截图:
 
主要内容:

1 ‐‐ 2020‐10‐06日的数据格式,源库与ods层数据保持一致。2020‐10‐07日已变 更,ods层数据日期时间已更改为timestamp 2 select 3 pay_time 4 ,to_timestamp(pay_time) as timestamp_pay_time ‐‐ int类型的1548641 820转换成时间戳类型 5 ,to_char(to_timestamp(pay_time),'yyyy‐mm‐dd hh24:mi:ss') as char _pay_time ‐‐ 转换成varchar类型,注意事项:时分秒数据是 hh:mi:ss 6 ,to_char(to_timestamp(pay_time),'yyyy‐mm‐dd') as char_pay_time_1 ‐‐ 转换成varchar类型的日期数据
7 ,to_date(to_char(to_timestamp(pay_time),'yyyy‐MM‐dd hh:mi:ss'),'yyyy‐MM‐dd') as date_pay_time 8 ,substring(to_char(to_timestamp(pay_time),'yyyy‐MM‐dd hh:mi:ss') from 1 for 10) as char_pay_time 9 from ods.ods_order_hi 10 where order_sn = '201901281016476967' 11 对应结果:1548641820 2019‐01‐28 10:17:00 2019‐01‐28 10:17:00 201 9‐01‐28 2019‐01‐28 2019‐01‐28 02.gp获取当前时间 1 select now(); ‐‐ 获取当前时间到年月日timestamp类型:2020‐10‐07 11:3 4:11 2 select to_char(now(),'yyyymmdd');‐‐ 20201007 varchar类型 3 select to_char(now(),'yyyy‐mm‐dd hh12:mi:ss');‐‐ 2020‐10‐07 11:3 7:39 varchar类型 4 select to_char(now(),'yyyy‐mm‐dd hh24:mi:ss');‐‐ 2020‐10‐07 11:3 7:39 varchar类型 5 select current_timestamp; ‐‐ 2020‐10‐07 11:37:39 timestamp类型 6 select localtimestamp; ‐‐ 2020‐10‐07 11:37:39 timestamp类型, 获取本地时间 7 select localtime; ‐‐ 11:37:39 timestamp类型,获取本地时间 8 select current_time; ‐‐ 11:37:39 timestamp类型,当前时间 9 select current_date; ‐‐ 2020‐10‐07 date类型,当前日期 03.gp日期函数加减 1 select now()+interval '2 day'; ‐‐ timestamp类型,2020‐10‐09 11:44: 45 2 select now()‐interval '2 day'; ‐‐ timestamp类型,2020‐10‐05 11:44: 45 34 select now()+interval '2 mon'; ‐‐ timestamp类型,2020‐12‐07 11:44: 45 5 select now()‐interval '2 mon'; ‐‐ timestamp类型,2020‐08‐07 11:44: 45 04.gp时间截取年月日 1 select extract(year from now()) ‐‐ 为int类型 or to_char(now(),'yy yy') ‐‐ 获取年 2 select extract(mon from now()) ‐‐ 为int类型 or to_char(now(),'m m') ‐‐ 获取月 3 select extract(day from now()) ‐‐ 为int类型 or to_char(now(),'d d') ‐‐ 获取日

 
 
------分隔线----------------------------


锋哥推荐