another newbie question re: converting dates to other formats

  • Okay, here's another thing I have been struggling with all afternoon... you all are so good at this, I'm hoping you can help me again.  🙂

    I have a date stored in a varchar field, in the following format:  2006-05-21 (yyyy-mm-dd).  I need to convert it to this format instead:  21MAY05 (ddMONyy), and then send it on to another table. 

    I've been trying the convert/cast stuff, but can't find anything that does 3-day months in there.  Any ideas?  Thanks for the help...

     

     

     

     

  • Best option is something like this

     

    Declare @StringDate varchar(10)

    set @StringDate = '12/15/2005'

    select replace(convert(varchar(12), convert(datetime,@Stringdate), 6),' ','')

     

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

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