RE: Date formatting using convert

RE: Date formatting using convert

 

  


here's a workaround:

select (cast(month(cast('2004-07-28 12:53:29.957' as datetime)) as
varchar) + '-' +
cast(day(cast('2004-07-28 12:53:29.957' as datetime)) as
varchar) + '-' +
cast(year(cast('2004-07-28 12:53:29.957' as datetime)) as
varchar)) as sample_date


-----Original Message-----
From: Biswaranjan Rath
[mailto:mssqldba-ezmlmshield-x80381579.[Email address protected]
Sent: Thursday, July 29, 2004 1:25 PM
To: LazyDBA Discussion
Subject: Date formatting using convert



Syntax of Conevrt is
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
I'm trying as
select convert(datetime [ 8 ], '2004-07-28 12:53:29.957', 110)
but it's not working. even i tried
select convert(datetime [ 'mm-dd-yyyy' ], '2004-07-28 12:53:29.957',
110)
i want the date in mm-dd-yyyy format. so can anyone suggest me...


With best regards

Biswaranjan Rath
Subject Matter Expert
Amdocs DVCI, Pune, India
Phone : +91-20-4048951 Extn.: 302(Office)
+91-20-4062302 (Direct)












------------------------------------------------------------------------
-------------

The information contained in this message is proprietary of Amdocs,

protected from disclosure, and may be privileged.

The information is intended to be conveyed only to the designated
recipient(s)

of the message. If the reader of this message is not the intended
recipient,

you are hereby notified that any dissemination, use, distribution or
copying of

this communication is strictly prohibited and may be unlawful.

If you have received this communication in error, please notify us
immediately

by replying to the message and deleting it from your computer.

Thank you.

---------------------------------------------------------


---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]


MS Sql Server LazyDBA home page