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.
SELECT Ename, FORMAT(HireDate, ‘d MMM yyyy hh:mm:ss.sss’) as JoinDate FROM Emp
Output: 17 Dec 1980 12:00:00.00
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