[英]How to convert String date dd-mmm-yyyy hh:mm specific format to Date format
I'm currently working with CSV data and trying to import into data studio.我目前正在使用 CSV 数据并尝试导入数据工作室。 The date variable is as string data type and format in CSV is "dd-mmmm-yyyy hh:mm" EXAMPLE: "6-Sept-2022 18:21:33".日期变量为字符串数据类型,CSV 中的格式为“dd-mmmm-yyyy hh:mm”示例:“6-Sept-2022 18:21:33”。
How to convert string to date data type.如何将字符串转换为日期数据类型。
Please, I need help.拜托,我需要帮助。
Regards问候
the month must be written like this 'Sep' or 'September' and then you can use月份必须写成这样'Sep'或'September'然后你可以使用
this for Sep:这是九月的:
select to_timestamp('6-Sep-2022 18:21:33','dd-Mon-yyyy HH24:MI:ss')::timestamp
this for September:这是九月的:
select to_timestamp('6-September-2022 18:21:33','dd-Month-yyyy HH24:MI:ss')::timestamp
you can convert 'Sept' in 'Sep' with:您可以将 'Sep' 中的 'Sep' 转换为:
select to_timestamp( replace( '6-Sept-2022 18:21:33','Sept','September'),'dd-Month-yyyy HH24:MI:ss')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.