sql server - convert DATETIME to formated string

Hi..
I have the following DATETIME field.   PURCHASED_DATE = 2013-01-02 09:00:00.000
I need to return the field / data in the following format

as

'Wed  Jan 2  9:00 AM'

thx
LVL 1
JElsterAsked:
Who is Participating?
 
Lee SavidgeConnect With a Mentor Commented:
If you really need a space between the time and AM/PM then you could do this:

SELECT DATENAME(dw, GETDATE()) + ' ' + replace(replace(CONVERT(nvarchar(50), getdate(), 100), 'AM', ' AM'), 'PM', ' PM')
0
 
Lee SavidgeCommented:
SELECT DATENAME(dw, GETDATE()) + ' ' + CONVERT(nvarchar(50), getdate(), 100)
0
 
James MurrellConnect With a Mentor Product SpecialistCommented:
sorry for just a link, but this should explain everything for you

http://www.sql-server-helper.com/tips/date-formats.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.