Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snowflake date_trunc to remove time from date

I have snowflake column which contains date in yyyy-mm-dd hh:MM:ss format.

I use the below function

 date_trunc('DAY', '2019-09-23 12:33:25')

Output : 2019-09-23 00:00:00

Expected as per documentation : 2019-09-23

Is it a bug or is there any other way to remove the time component altogether ?

like image 823
Vinod Jayachandran Avatar asked Oct 18 '25 04:10

Vinod Jayachandran


1 Answers

Depending on what you're wanting to do with the date, having a midnight time is fine.

If you really must get rid of it, this will work:

cast(date_trunc('DAY', '2019-09-23 12:33:25') as date)
like image 186
cmcau Avatar answered Oct 22 '25 06:10

cmcau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!