While writing SQL Server queries, often I need to extract date part from DateTime columns/variables and it’s very easy to do that:
Bonus: How To Retrieve Time Part Alone From DateTime Field
Here is the bonus tip to get the time part alone from DateTime fields
Hope this helps you.
3 thoughts on “Get Date From DateTime Field (SQL Server)”
Thanks for the tip. It’s better than the solution provided in the post.
This conversion works, but may not be very quick.
This one should be faster:
select dateadd(day, datediff(day, 0, getdate()), 0);
There is a good article on:
How to display Date Only Format in GridView
How to Get First and Last Date of a month?