January 10, 2012

convert date in 'MM/DD/YYYY HH:MI A.M.' format using MS sql


 convert date in 'MM/DD/YYYY HH:MI A.M.' format using MS sql

select CONVERT(nvarchar(30), GETDATE(), 101) + ' ' + CONVERT(nvarchar(30), GETDATE(), 114)
format sequence
101 = mm/dd/yyyy
108 = hh:mi:ss
114 = hh:mi:ss:mmm(24h)

No comments:

Post a Comment