SQL date formatting is a common task. When creating reports or getting data, everyone tries to convert the date. In SQL Server, the date can be formatted in a variety of ways.
Method-1:
SELECT Ename, FORMAT(HireDate, ‘d MMM yyyy hh:mm:ss.sss’) as JoinDate FROM Emp
Output: 17 Dec 1980 12:00:00.00
Method-2:
SELECT Ename, CONVERT(VARCHAR(40), HireDate, 113) as JoinDate FROM Emp
Output: 17 Dec 1980 00:00:00:000
For more information please click on the following link:
SQL Server DATE TIME Functions