I'm currently working with CSV data and trying to import into data studio. 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".
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
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:
select to_timestamp( replace( '6-Sept-2022 18:21:33','Sept','September'),'dd-Month-yyyy HH24:MI:ss')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.