ben890
ben890

Reputation: 1133

Parse date format to timestamp in Snowflake

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'

Upvotes: 0

Views: 949

Answers (1)

Greg Pavlik
Greg Pavlik

Reputation: 11046

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.

Upvotes: 4

Related Questions