Monday, October 18, 2010

Date & Time Formats

Format Query (current date: 8/30/2010) Sample
111 select convert(varchar, getdate(), 111) 8/30/2010
110 select convert(varchar, getdate(), 110) 8/30/2010
107 select convert(varchar, getdate(), 107) 30-Aug-10
106 select convert(varchar, getdate(), 106) 30-Aug-10
105 select convert(varchar, getdate(), 105) 30-8-2010
104 select convert(varchar, getdate(), 104) 30.8.2010
103 select convert(varchar, getdate(), 103) 30/8/2010
102 select convert(varchar, getdate(), 102) 2010.8.30
101 select convert(varchar, getdate(), 101) 8/30/2010
11 select convert(varchar, getdate(), 11) 6/8/1930
10 select convert(varchar, getdate(), 10) 8/30/2010
7 select convert(varchar, getdate(), 7) 30-Aug-10
6 select convert(varchar, getdate(), 6) 30-Aug-10
5 select convert(varchar, getdate(), 5) 30-8-06
4 select convert(varchar, getdate(), 4) 30.8.06
3 select convert(varchar, getdate(), 3) 30/8/06
2 select convert(varchar, getdate(), 2) 06.8.30
1 select convert(varchar, getdate(), 1) 8/30/2010

TIME FORMATS
8 or 108 select convert(varchar, getdate(), 8) 8:38:54
9 or 109 select convert(varchar, getdate(), 9) Dec 30 2010 8:38:54:840AM
14 or 114 select convert(varchar, getdate(), 14) 00:38:54:840

No comments: