Visual Studio 2008 - 2010 - Developer Resourses - Debug breakpoint with condition ::: Lionfish Tehcnologies



Home / Developers Resourses / Tips

MS SQLServer Convert datetime to the most common format mm/dd/yyyy hh:mmAMPM

I don't know why it is than hard, just to get the most common and easy datetime format


Here is the SQLServer code

SELECT CONVERT(VARCHAR(25), getdate(), 101) + ' ' + REPLACE(REPLACE(RIGHT('0'+LTRIM(RIGHT(CONVERT(varchar, getdate(),100),7)),7),'AM',' AM'),'PM',' PM')

Result:

05/07/2012 02:33 PM


Lionfish Technologies ® 2009 All rights reserved