Convert getDate()

  • Does anyone know how I can convert getDate() to display:

    Dec 7, 2005

    Select CONVERT(CHAR(12),GETDATE(),0)

    Will display: Dec  7 2005  But I need the extra space removed and a ',' comma after the 7 displayed.

    Any guidance would be appreciated, thanks!

     

  • Select Convert(char(12),getdate(),107)

    Dec 07, 2005

    What extra space do you speak of?

    From books online

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2f3o.asp

    The table in the page indicates the format and what # you should use to get that format, Note 7 will give U 2 digit year, 107 gives you 4 ie 05, or 2005

     

  • Thanks Ray!

    I looked at SQL online help... I don't know how I missed that one. 

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply