使用Momentjs将毫秒转换为小时和分钟 [英] Convert milliseconds to hours and minutes using Momentjs
本文介绍了使用Momentjs将毫秒转换为小时和分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Momentjs的新手。我试图用它来将毫秒转换为小时和分钟。下面,x是毫秒
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;
有人可以帮忙吗?
推荐答案
我最终这样做...
var x = 433276000
var tempTime = moment.duration(x);
var y = tempTime.hours() + tempTime.minutes();
这篇关于使用Momentjs将毫秒转换为小时和分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文