Aruna Raghunam Aruna Raghunam - 1 month ago 10
SQL Question

convert yyyy-mm-dd hh:mm:ss to yyyy-mm-dd in sql

I need to convert yyyy-mm-dd hh:mm:ss.msec to yyyy-mm-dd in sql.

I tried

CONVERT(DATETIME,MIN(Vdaily_calender.VDC_day_date),120)


but getting same result.

Please advise

Thanks
Ar

Answer

I suspect you are overthinking it. A simple cast as date will do the trick

Select Cast(SomeDateTime as date)