Date formats in SQL

Hello friends, today I am going to talk about a popular topic in SQL Server that is formatting dates. We use different date formats in different scenarios, I am going to write down all possible date formats in SQL Server.

SELECT CONVERT(VARCHAR(25), GETDATE(), 100) as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 1) as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 101)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 2) as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 102)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 3)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 103)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 4)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 104) as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 5) as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 105)as Date_Format

 

SELECT CONVERT(VARCHAR(25), GETDATE(), 6) as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 106)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 7)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 107)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 108)as Date_Format


 SELECT CONVERT(VARCHAR(30), GETDATE(), 109)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 10)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 110)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 11)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 111)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 12)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 112)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 113)as Date_Format


 SELECT CONVERT(VARCHAR(25), GETDATE(), 114)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 120)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 121)as Date_Format


SELECT CONVERT(VARCHAR(25), GETDATE(), 126)as Date_Format


I hope you will find this article useful. Have a good day..

2 comments:

Danny said...

Thanks - I hate that I always have to google different date formatting. This was a one stop shop.

nky said...

Thanks Danny for liking the content..