MS SQL Show Only Date of Current Time

In MS SQL Server, we get the current time with the getdate() method. But this method gives us results with hours, minutes, seconds and milliseconds.

If we want to get the current time in year, month, day format only, the following query should be run.

SELECT CONVERT(date, getdate()) AS ourVarName


You May Interest

What is an OUTPUT Clause Inside SQL Server ?

Finding Session Id in MS SQL User's Current Process

What are Some Advantages of Using CTE in SQL Server ?

What is the Difference Between VARCHAR and NVARCHAR in SQL Server ...

How to Restart SQL Server in Single-User Mode ?