tags:

views:

21

answers:

1

This snippet:

select Datename(hh,DATEADD(HH, -5, [time])) + ':' + Datename(mi,[time])....

will produce:

11:4

But i need the leading '0' in front of the '4'.

A: 

You can pad the minutes with leading zeros, and then take the right two characters:

SELECT Datename(hh,DATEADD(HH, -5, [time])) + ':' + 
    right('00' + Datename(mi,[time]), 2)
LittleBobbyTables