December 1, 2009 at 6:07 am
I'm trying to extract the start time of a meeting in the following format:
3:00 PM
If I use the following as an example for the code:
Select CONVERT(CHAR(19), MeetingStart, 0) from MeetingTable
It returns the following:
Jan 4 2010 3:00PM
Is there a way to just return the time but also put a space between 3:00 and PM so that it is
3:00 PM ?
Thank you.
Rog
December 1, 2009 at 6:21 am
Select LEFT(RIGHT(convert(varchar(20), getdate(), 100), 7), 5) + ' ' +
RIGHT(convert(varchar(20), getdate(), 100), 2)
---------------------------------------------------------------------------------
December 1, 2009 at 6:22 am
Select ltrim(rtrim(substring(CONVERT(CHAR(19), getdate(), 0),12,10)))
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 1, 2009 at 8:09 am
Works perfectly! Thank you so much.
Rog
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply