SQL DateTime Format

Date Formats :

Format #

Query

Output

1

SELECT convert(VARCHAR, getdate(), 1)

02/20/10

2

SELECT convert(VARCHAR, getdate(), 2)

10.02.20

3

SELECT convert(VARCHAR, getdate(), 3)

20/02/10

4

SELECT convert(VARCHAR, getdate(), 4)

20.02.10

5

SELECT convert(VARCHAR, getdate(), 5)

20-02-10

6

SELECT convert(VARCHAR, getdate(), 6)

20 Feb 10

7

SELECT convert(VARCHAR, getdate(), 7)

Feb 20, 10

10

SELECT convert(VARCHAR, getdate(), 10)

02-20-10

11

SELECT convert(VARCHAR, getdate(), 11)

02-20-10

101

SELECT convert(VARCHAR, getdate(), 101)

02/20/2010

102

SELECT convert(VARCHAR, getdate(), 102)

2010.02.20

103

SELECT convert(VARCHAR, getdate(), 103)

20/02/2010

104

SELECT convert(VARCHAR, getdate(), 104)

20.02.2010

105

SELECT convert(VARCHAR, getdate(), 105)

20-02-2010

106

SELECT convert(VARCHAR, getdate(), 106)

20 Feb 2010

107

SELECT convert(VARCHAR, getdate(), 107)

Feb 20, 2010

110

SELECT convert(VARCHAR, getdate(), 110)

02-20-2010

111

SELECT convert(VARCHAR, getdate(), 111)

2010/02/20

 

Time Formats :

Format #

Query

Output

8

SELECT convert(VARCHAR, getdate(), 8)

01:12:59

9

SELECT convert(VARCHAR, getdate(), 9)

Feb 20 2010  1:13:19:430AM

14

SELECT convert(VARCHAR, getdate(), 14)

01:13:38:647