Home > Back-end >  How to change the format of a date field in SQL?
How to change the format of a date field in SQL?

Time:03-03

I have a date field in one of my tables that's formatted like this: 20220212.

I want to CAST it like this: 2022/02/12 but a simple CAST(DATE_FIELD AS DATE) doesn't seem to work. ANyone know how I can achieve this with SQL in Snowflake?

Thanks!

CodePudding user response:

Please try to_date()

to_date(DATE_FIELD, 'YYYY/MM/DD')

enter image description here

  • Related