Home > Back-end >  Parse date format to timestamp in Snowflake
Parse date format to timestamp in Snowflake

Time:10-02

I have dates in the following format 9/28/21 8:08 AM and want to parse to timestamp. What is the best way to do this?

I have tried:

TO_TIMESTAMP_NTZ(colname, 'mm/dd/yy HH:MM AM')

But I'm getting the following error:

Can't parse '9/28/21 8:08 AM' as timestamp with format 'm/dd/yy HH:MM AM'

CodePudding user response:

select try_to_timestamp_ntz('9/28/21 8:08 AM', 'MM/DD/YY HH12:MI AM');

You need 12 hour clock and MI for minutes.

  • Related