conver...

  • hi peeps!

    how do i convert from > 2002-03-12 00:00:00.000 to 2002-03-12

    thx

  • I don't see a SQL Style with dashes.  You could try the following:

    SELECT GETDATE(), CONVERT( varchar(10), GETDATE(), 112),

                 SUBSTRING( CONVERT( varchar(10), GETDATE(), 112), 1, 4) + '-' +

                     SUBSTRING( CONVERT( varchar(10), GETDATE(), 112), 5, 2) + '-' +

                     SUBSTRING( CONVERT( varchar(10), GETDATE(), 112), 7, 2)

    I wasn't born stupid - I had to study.

  • darn.....lol

    thx lot man

     

  •  

    select getdate(), convert(varchar(10),getdate(),121)
     
  • That's it, Michael!  Did not see that number in my reference book. 

    I wasn't born stupid - I had to study.

Viewing 5 posts - 1 through 4 (of 4 total)

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