Date Format |
Format # |
Query (current date: 12/30/2006) |
Example |
1 |
Select convert (varchar, getdate (), 1) |
12/30/06 |
2 |
Select convert (varchar, getdate (), 2) |
06.12.30 |
3 |
Select convert (varchar, getdate (), 3) |
30/12/06 |
4 |
Select convert (varchar, getdate (), 4) |
30.12.06 |
5 |
Select convert (varchar, getdate (), 5) |
30-12-06 |
6 |
Select convert (varchar, getdate (), 6) |
30 dec 06 |
7 |
Select convert (varchar, getdate (), 7) |
Dec 30, 06 |
10 |
Select convert (varchar, getdate (), 10) |
12-30-06 |
11 |
Select convert (varchar, getdate (), 11) |
06/12/30 |
101 |
Select convert (varchar, getdate (), 101) |
12/30/2006 |
102 |
Select convert (varchar, getdate (), 102) |
2006.12.30 |
103 |
Select convert (varchar, getdate (), 103) |
30/12/2006 |
104 |
Select convert (varchar, getdate (), 104) |
30.12.2006 |
105 |
Select convert (varchar, getdate (), 105) |
30-12-2006 |
106 |
Select convert (varchar, getdate (), 106) |
30 Dec 2006 |
107 |
Select convert (varchar, getdate (), 107) |
Dec 30,200 6 |
110 |
Select convert (varchar, getdate (), 110) |
12-30-2006 |
111 |
Select convert (varchar, getdate (), 111) |
2006/12/30 |
|
|
|
Time Format |
8 or 108 |
Select convert (varchar, getdate (), 8) |
00:38:54 |
9 or 109 |
Select convert (varchar, getdate (), 9) |
Dec 30 2006 12: 38: 54: 840am |
14 or 114 |
Select convert (varchar, getdate (), 14) |
00: 38: 54: 840 |