Wednesday, March 7, 2012

Date format

I have getting following date format when I run query in QA.
2006-12-09 00:01:09.000
How can I chage to 12/09/2006 00:01:09:000 format (MM/DD/YYYY HH:MM:SS) ?
Thanks for your help in Advnace.Use convert
http://msdn2.microsoft.com/en-us/library/ms187928.aspx|||I used the convert as follows

convert(varchar(20),starttime,101 )

but it just retrun only the date 12/09/2006 it does not shows time

I need time stamp too.|||select convert(varchar(10), convert(datetime, '2006-12-09 00:01:09.000', 121), 103) +
' ' + convert(varchar(12), convert(datetime, '2006-12-09 00:01:09.000', 121), 114)

or the other way:

select convert(varchar(19), convert(datetime, '12/09/2006 00:01:09:000', 103), 121)

No comments:

Post a Comment