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 *

You May Also Like

When dealing with a relational database management system (RDBMS) like SQL Server, compatibility level is an important concept to understand....
In this blog post, let’s learn about the error message “49975 – Unable to load controller client certificate due to...
In this blog post, let’s learn about the error message “49973 – Cannot remove tempdb remote file to local tempdb...