Tuesday, May 6, 2008

converting Date into string in different style

hi

i submit for converting date into string in different style by help of sql server help?

select



CONVERT(varchar,CONVERT(datetime,getdate()),106) as date

output

06 May 2008

other style u want help like this

0 or 100 | Default |mon dd yyyy hh:miAM (or PM)
 101 | U.S.| mm/dd/yyyy
 102 | ANSI |yy.mm.dd
 103|British/French|dd/mm/yy
 104|German|dd.mm.yy
 105|Italian|dd-mm-yy
 106 (1)|-|dd mon yy
 107 (1)|-|Mon dd, yy
 108|-  |hh:mm:ss
 9 or 109 (1, 2) |Default + milliseconds|mon dd yyyy hh:mi:ss:mmmAM (or PM)
 110|USA|mm-dd-yy
 111|JAPAN|yy/mm/dd
 112|ISO|yymmdd
 13 or 113 (1, 2) | Europe default + milliseconds| dd mon yyyy hh:mm:ss:mmm(24h)
 114|-|hh:mi:ss:mmm(24h)
 20 or 120 (2) |ODBC canonical| yyyy-mm-dd hh:mi:ss(24h)
 21 or 121 (2) |ODBC canonical (with milliseconds)| yyyy-mm-dd hh:mi:ss.mmm(24h)
 126 (4)|ISO8601|yyyy-mm-ddThh:mm:ss.mmm (no spaces)
 127(6)|ISO8601 with time zone Z.|yyyy-mm-ddThh:mm:ss.mmmZ
 130 (1, 2)|Hijri (5)|dd mon yyyy hh:mi:ss:mmmAM
 131 (2)|Hijri (5)|dd/mm/yy hh:mi:ss:mmmAM
 

No comments :

Post a Comment

AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath