相关疑难解决方法(0)

如何用momentjs将时间(hh:mm)转换为十进制形式

使用momentjs将小时分钟转换为小数时间的最佳方法是什么

假设我有1:30分钟,我希望转换后有1.5

这是我尝试过的

console.log(travelTime().split(':')[0]);   return 1
console.log(travelTime().split(':')[1]);   return 30  then / 30
Run Code Online (Sandbox Code Playgroud)

travelTime()=="1:30"

momentjs

8
推荐指数
1
解决办法
8372
查看次数

Add hours minutes with the format hh:mm using moment

I am using moment library and from front end I am getting time in HH:mm I need to add hours and minutes to current time using moment.

Suppose I am getting 05:30 from the frontend and I need to add to the current UTC time. How can I do that using momentjs?

I tried that but didn't work

moment().add('05:30', 'HH:mm')
Run Code Online (Sandbox Code Playgroud)

javascript timezone momentjs

1
推荐指数
1
解决办法
168
查看次数

标签 统计

momentjs ×2

javascript ×1

timezone ×1