Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools


You can use convert function to format your datetime the only thing you need to to know is format type which is a integer number. This sample output will help you to find your format id quickly.

Click here to copy the following block
--//Date/Time formatting with SQL Server

declare @mystyle int
set @mystyle=101
select Convert(varchar(30),Getdate(),@mystyle)

--//convert function with different style will produce following output

/*
ID    Date/Time
============================
< 0  > May 31 2004 8:58PM
< 1  > 05/31/04
< 2  > 04.05.31
< 3  > 31/05/04
< 4  > 31.05.04
< 5  > 31-05-04
< 6  > 31 May 04
< 7  > May 31, 04
< 8  > 20:58:45
< 9  > May 31 2004 8:58:45:090PM
< 10 > 05-31-04
< 11 > 04/05/31
< 12 > 040531
< 13 > 31 May 2004 20:58:45:107
< 14 > 20:58:45:107
< 20 > 2004-05-31 20:58:45
< 21 > 2004-05-31 20:58:45.120
< 22 > 05/31/04 8:58:45 PM
< 23 > 2004-05-31
< 24 > 20:58:45
< 25 > 2004-05-31 20:58:45.120
< 100 > May 31 2004 8:58PM
< 101 > 05/31/2004
< 102 > 2004.05.31
< 103 > 31/05/2004
< 104 > 31.05.2004
< 105 > 31-05-2004
< 106 > 31 May 2004
< 107 > May 31, 2004
< 108 > 20:58:45
< 109 > May 31 2004 8:58:45:340PM
< 110 > 05-31-2004
< 111 > 2004/05/31
< 112 > 20040531
< 113 > 31 May 2004 20:58:45:340
< 114 > 20:58:45:340
< 120 > 2004-05-31 20:58:45
< 121 > 2004-05-31 20:58:45.357
< 126 > 2004-05-31T20:58:45.370
< 130 > 12 ???? ?????? 1425 8:58:45:387PM
< 131 > 12/04/1425 8:58:45:387PM

*/


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.