Search code examples
datesnowflake-cloud-data-platformvarchar

VARCHAR to DATE in Snowflake


Hello I need varchar to date.

My varchar looks like this:

  • Oct 2, 2020

This is my desired output:

  • 2020-10-02

Any ideas? Thanks in advance!

Here is the error I get when trying to_date:

enter image description here


Solution

  • The format you should use is 'MON DD, YYYY':

    select to_date('Oct 2, 2020', 'MON DD, YYYY')