RSS

Category Archives: Dates in SQL

Dates in SQL

Hi Folks!!!!!
This time i am here with very important but basic topic of “How to use DATE in different format in SQL”.
Here by i am mentioning some of the important formats of dates which we used in daily work.

Few Generic queries :

 

Format                            Query Results
1 Select convert(varchar,getdate( ),1) 08/31/11
2 Select convert(varchar,getdate( ),2) 11.08.31
3 Select convert(varchar,getdate( ),3) 31/08/11
4 Select convert(varchar,getdate( ),4) 31.08.11
5 Select convert(varchar,getdate( ),5) 31-08-11
6 Select convert(varchar,getdate( ),6) 31 Aug 11
7 Select convert(varchar,getdate( ),7) Aug 31 11
10 Select convert(varchar,getdate( ),10) 08-31-11
11 Select convert(varchar,getdate( ),11) 11/08/31
101 Select convert(varchar,getdate( ),101) 08/31/11
102 Select convert(varchar,getdate( ),102) 2011.08.31
103 Select convert(varchar,getdate( ),103) 31/08/2011
104 Select convert(varchar,getdate( ),104) 31.08.2011
105 Select convert(varchar,getdate( ),105) 31-08-2011
106 Select convert(varchar,getdate( ),106) 31 Aug 2011
107 Select convert(varchar,getdate( ),107) Aug 31 2011
110 Select convert(varchar,getdate( ),110) 08-31-2011
111 Select convert(varchar,getdate( ),111) 2011/08/31

Author : Feel free to put on your query here, i will be more than happy if i will help you.

Advertisements
 
Leave a comment

Posted by on October 27, 2011 in Dates in SQL, SQL Concepts