Number of hours to HH:MM with Moment.js (or without)

Posted: asked May 19 at 11:21 - Source : stackoverflow

I have very simple problem, but couldn't find good simple DRY solution. I want to convert number of hours to HH:MM format. My try with Moment.js is:

var hours = 10.5
var hour_string = moment(hours*3600*1000).format('HH:MM')

But unfortunately I get:


and have no idea why. Of course my wanted result is "10:30".

I'd like just do it in the easiest way, similar as I can do in Rails:*3600).utc.strftime("%H:%M")

Any ideas?