sql - Convert Values with Timezone to timestamp
问题描述
I need to convert some values (in text format) to TIMESTAMP data type before loading to Oracle tables. The values are having Timezone info as in below samples:
2018-05-28T14:32:53.5860707+08:00
2018-05-30T08:26:47.554801+08:00
2018-05-21T16:26:29.5443257+08:00
Can you please help?
Thanks,
David
解决方案
You want to use to_timestamp_tz with format string 'YYYY-MM-DD"T"HH24:MI:SS:FFTZH:TZM'. Put the "T" in quotes in the format string.
select
to_timestamp_tz('2018-05-28T14:32:53.5860707+08:00', 'YYYY-MM-DD"T"HH24:MI:SS:FFTZH:TZM')
from dual
推荐阅读
- python - Python(Pandas)中每周时间范围内数据的特定聚合
- python - 关于 any()/all() 的另一个 Python 问题
- python - 为什么 crontab 执行一个 python 文件而不执行另一个?
- swiftui - SwiftUI 将当前视图中导航栏按钮的文本标题更改为“后退”,而不是从前一个视图标题继承文本
- c - 如何生成 GSL GNU
没有 SUDO 权限? - ssh - 简化 SCP - 部分通过反向隧道 - 三个节点之间的连接
- firebase - Firebase 云功能 paypal 适用于本地主机,但不适用于服务器
- python - 将文件从 filedialogue 传递到另一个函数 tkinter
- angular - 如何让 mat-select 显示适当的选项?
- oracle - 还原表空间 USERS 不起作用。甲骨文备份