Introduction to Remove Times from Dates in SQL Server

There are many approaches to remove Time from Date Columns with data and time. Below are the common approaches used now. This can vary for older SQL Versions.

  1. CAST To Date Data Type
  2. CONVERT Function with Style Code
  3. Format Function

Below is the sample data from EmployeesInfo with the ‘DateJoined‘ date time column. This data is used in the examples below.

EmployeesInfo Table data

How to Remove Times from Dates in SQL Server

In SQL Server, there are Date and DateTime data types to store Date and Time values. There can be situations when only the date value needs to be displayed or to do date calculations for date add, date difference functions, and between two dates from datetime values. So, to remove the Time part from dates with data and time, many methods can be used based on need and usage.

In this article, we will discuss methods such as CAST to Date Data Type, CONVERT Function with Style Code, and Format Function (For SQL Version 2012 and Later) to Remove Times from Dates in SQL Server in detail.

Similar Reads

Introduction to Remove Times from Dates in SQL Server

There are many approaches to remove Time from Date Columns with data and time. Below are the common approaches used now. This can vary for older SQL Versions....

Method 1: CAST to Date Data Type

The CAST method directly converts the datetime value to date data type which removes the time component....

Method 2: CONVERT Function with Style Code

The CONVERT function is used to convert the datetime value into date only....

Method 3: Format Function (For SQL Version 2012 and Later)

The FORMAT function can also be used to get only the date part from a datetime expression or date column in a table....

Conclusion

In this article, We have discussed about how to remove Time from Date string or expression or date value in a column in Table. We discussed about three function methods namely CAST, CONVERT and FORMAT. The FORMAT function is available for SQL Version 2012 and above. Also, it is to be noted that the there is Date data type which stores DATE value only in SQL Version from 2008 and above....