August 6, 2009 at 2:53 pm
Extract time from datetime column along with AM or PM
select MyDate from X
SELECT CONVERT(VARCHAR,mydate,108) from X....this only gets the time part but not AM or PM. I need both.
Thanks
August 6, 2009 at 8:19 pm
Here's how but I need to know... why do you need to do this type of formatting in SQL?
SELECT STUFF(RIGHT(CONVERT(VARCHAR(50),GETDATE(),109),14),9,4,'')
--Jeff Moden
Change is inevitable... Change for the better is not.
August 7, 2009 at 3:31 am
Use
SELECT CONVERT(VARCHAR,GETDATE(),109) or
SELECT CONVERT(VARCHAR,GETDATE(),100) or
SELECT CONVERT(VARCHAR,GETDATE(),9)
August 7, 2009 at 3:31 am
Use
SELECT CONVERT(VARCHAR,GETDATE(),109) or
SELECT CONVERT(VARCHAR,GETDATE(),100) or
SELECT CONVERT(VARCHAR,GETDATE(),9)
August 7, 2009 at 8:42 am
Mohan Kumar (8/7/2009)
UseSELECT CONVERT(VARCHAR,GETDATE(),109) or
SELECT CONVERT(VARCHAR,GETDATE(),100) or
SELECT CONVERT(VARCHAR,GETDATE(),9)
None of those produce what was asked for.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply