字符串转时间格式

本文详细介绍了如何在从Oracle数据库迁移到ImpalaSQL的过程中,处理和转换日期时间数据,包括`to_char`、`substr`、`regexp_replace`等函数的使用以及日期格式的标准化操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

orcal转impalasql

to_char(inag_date,'yyyymmdd')
substr(regexp_replace(CAST(inag_date AS STRING),'-',''),1,8)
to_char(sysdate,'yyyymmdd')
substr(regexp_replace(CAST(now() AS STRING),'-',''),1,8)
substr(concat(psabuc001,'01'),1,8)
substr(cast(date_ as string),'-',''),1,8)
substr(replace(cast(now() as string),'-',''),1,8)

to_char(date_,'yyyymmdd')>=to_char(sysdate,'yyyymmdd')
substr(cast(date_ as string),1,8) >=substr(replace(cast(now() as string),'-',''),1,8)

from_unixtime(unix_timestamp(days_add(now(),7)),'yyyy-mm-dd')

from_utc_timestamp(substr(concat(psabuc001,'01'),1,8),'yyyy-mm-dd')

from_timestamp(substr(concat(psabuc001,'01'),1,8),'yyyy-mm-dd')

字符串转时间格格式
yyyymmdd转yyyyMMdd

select psabuc001 from erp_t;
select concat(psabuc001,'01') from erp_t;
select unix_timestamp(concat(psabuc001,'01'))from erp_t;
select from_unixtime(unix_timestamp(concat(psabuc001,'01'),'yyyyMMdd'))from erp_t;


substr(concat(psabuc001,'01'),1,8)

from_unixtime(unix_timestamp(days_add(now(),7)),'yyyy-mm-dd')

from_utc_timestamp(substr(concat(psabuc001,'01'),1,8),'yyyy-mm-dd')

from_timestamp(substr(concat(psabuc001,'01'),1,8),'yyyy-mm-dd')


substr(concat(psabuc001,'01'),1,8)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值