简体   繁体   中英

Convert dates to dates with a first day of the month in Snowflake

There are dates, for example:

'2022-10-11'
'2022-01-20'
'2022-12-31'

How to convert them to the following dates in Snowflake?

'2022-10-01'
'2022-01-01'
'2022-12-01'

Thank you!

It could be achieved with DATE_TRUNC function:

SELECT DATE_TRUNC('MONTH',  col_name) FROM ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM