Converting time while retaining leading zero

Answered Converting time while retaining leading zero

  • Thursday, February 07, 2013 4:16 AM
     
     

    I am attemping to convert a datetime value to HH:MM PM or AM without losing the leading on a single digit hour.  I almost have it worked out but the leading zero is stumping me.  If someone knows a better way to do this even better, thanks you

    SELECT

    STUFF(RIGHT(' ' + CONVERT(VARCHAR(30),GETDATE(),100),7),6,0,' ') AS FormattedTime

All Replies