SQL Server 101 – Get the Date part from DateTime

You can use the convert function in SQL Server to retrieve only the date part from the date time.

How to get the Date part from DateTime variable in SQL Server ?

Here’s a sample code snippet demonstrating how to do it.

SELECT CONVERT(DATE, GETDATE())

The GETDATE returns the current date along with the time and the convert function extracts only the DATE part of it.

Leave a Reply

Your email address will not be published. Required fields are marked *