简体   繁体   English

如何将字符串日期 dd-mmm-yyyy hh:mm 特定格式转换为日期格式

[英]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

documentation here 文档在这里

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.

相关问题 将日期 isoString "2022-12-20T21:20:23.500Z" 转换为格式 DD/MM/YYYY hh:mm in Athena sql - Convert date isoString "2022-12-20T21:20:23.500Z" to format DD/MM/YYYY hh:mm in Athena sql 如何在 Postgresql 中将“MM/YY”字符串转换为日期格式“YYYY-MM-01” - How to Convert A' MM/YY' String in to a date format 'YYYY-MM-01' in Postgresql 无法在 pyspark 中将纪元时间戳转换为“dd-mm-yyyy HH:mm:ss”格式 - Unable to convert epoch timestamp into "dd-mm-yyyy HH:mm:ss" format in pyspark 如何在 Azure 数据工厂中将活动 output 格式化为 YYYY-MM-DD hh:mm:ss - How to format an activity output as YYYY-MM-DD hh:mm:ss in Azure data factory Google Cloud Storage 中的日期格式将日期更改为 YYYY-DD-MM 格式 - Date format in Google Cloud Storage changes date to YYYY-DD-MM format 将今天的日期与 dynamodb 表中的日期格式 YYYY-DD-MM 进行比较 - comparen today's date with date format YYYY-DD-MM in dynamodb table 如何将 yyyy-mm-dd hh:MM:SS.mil 形式的时间戳转换为 Athena 中的纪元时间 - How to convert timestamp in the form of yyyy-mm-dd hh:MM:SS.mil to epoch time in Athena 将奇怪的日期字符串转换为 pyspark 中的日期格式 - convert weird date string into date format in pyspark 使用 BigQuery 将 CURRENT_TIMESTAMP 转换为 dd/mm/yyyy hh:mm 字符串 - Cast CURRENT_TIMESTAMP to dd/mm/yyyy hh:mm string with BigQuery 解析字符串日期到日期格式 - Parsing string date to date format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM