DATETIME format help

  • Hi,

    can any one help me in converting the getdate() into YYYYMMDDHHMMSS format?

    can convert it into YYYYMMDD format using Select CONVERT(VARCHAR(8), GETDATE(), 112)

    but cannot the rest together.

    Note: for the time i dont want the colons in between.

    Thanks in advance

    Prasad

  • try this

    left(replace(replace(replace(replace(convert(varchar(23),GETDATE(),126),'-',''),':',''),'T',''),'.',''),14)

  • Hi

    You can script hear!

    Select CONVERT(VARCHAR(10), GETDATE(), 112) + '' + replace(CONVERT(VARCHAR(20), GETDATE(), 108),':','')

  • Both Works...Thanks a lot.

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

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