英文:
Convert varchar to timestamp in snowflake
问题
我有一张Snowflake表格中有几列,其中存储的日期时间格式为2022-04-27T10:38:21.3000000+1000,类型为VARCHAR。
我想将其转换为正确的Timestamp对象。我尝试了以下方法:
TO_TIMESTAMP('2022-04-27T10:38:21.3000000+1000')
但它报错说无法识别格式。请问有什么建议吗?
英文:
I have few columns in a snowflake table which has date time stored in the format
2022-04-27T10:38:21.3000000+1000 as VARCHAR.
I would want to convert it as proper Timestamp object. I tried using below
TO_TIMESTAMP('2022-04-27T10:38:21.3000000+1000')
It is throwing error as not recognized format. Any suggestion please?
答案1
得分: 1
你需要按照文档来指定日期/时间字符串的输入格式。
尝试这样做:
SELECT TO_TIMESTAMP('2022-04-27T10:38:21.3000000+1000', 'YYYY-MM-DDTHH:MI:SS.FFTZHTZM');
英文:
You need to specify the input format for your date/time string as per the doc
Try this:
SELECT TO_TIMESTAMP('2022-04-27T10:38:21.3000000+1000', 'YYYY-MM-DDTHH:MI:SS.FFTZHTZM');
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论