Aruna Raghunam Aruna Raghunam - 1 year ago 159
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


but getting same result.

Please advise


Answer Source

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

Select Cast(SomeDateTime as date)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download