In snowflake, I have a bad date format, something like this -
'Tue Aug 06 18:22:59 EDT 2019'
I am trying to convert it to the following date format -
YYYY-MM-DD HH:MM:SS
I have tried various TO_TIMESTAMP versions but nothing seems to work. Any suggestions/ help is truly appreciated.
SELECT TO_TIMESTAMP_NTZ('Wed May 29 23:36:39 EDT 2019', 'DY MON DD HH:MM:SS YYYY')
Error msg - Can't parse 'Wed May 29 23:36:39 EDT 2019' as timestamp with format'DY MON DD HH:MM:SS YYYY'
CodePudding user response:
This works in my Snowflake environment:
SELECT to_timestamp('Wed May 29 23:36:39 EDT 2019', 'DY MON DD HH24:MI:SS EDT YYYY') as dt
Using MI for minutes (not MM).
Output: 2019-05-29 23:36:39.000