Convert milliseconds to hours and minutes using Momentjs

I am new to Momentjs. I am trying to use it to convert milliseconds to hours and minutes. Below, x is milliseconds

x = 433276000
var y = moment.duration(x, 'milliseconds').asHours;

Can anyone help?


Solution 1:

I ended up doing this...

var x = 433276000
var tempTime = moment.duration(x);
var y = tempTime.hours() + tempTime.minutes();

Solution 2:

Try this:

var x = 433276000
var d = moment.duration(x, 'milliseconds');
var hours = Math.floor(d.asHours());
var mins = Math.floor(d.asMinutes()) - hours * 60;
console.log("hours:" + hours + " mins:" + mins);