Site icon Tech Dreams

Get Date From DateTime Field (SQL Server)

While writing SQL Server queries, often I need to extract date part from DateTime columns/variables and it’s very easy to do that:


SELECT convert(varchar,getdate(),101)

Bonus: How To Retrieve Time Part Alone From DateTime Field

Here is the bonus tip to get the time part alone from DateTime fields


SELECT convert(varchar,getdate(),108)

Hope this helps you.

Exit mobile version