I have a string realTime = 10:15
and i have subtract 1:20
means(one hours twenty minutes) from string realTime .
output should be = 8:55.
I am trying something with moment
moment().subtract(realTime , '1:20');
But it's not working, Help me to find the solution. Thanks
I have a string realTime = 10:15
and i have subtract 1:20
means(one hours twenty minutes) from string realTime .
output should be = 8:55.
I am trying something with moment
moment().subtract(realTime , '1:20');
But it's not working, Help me to find the solution. Thanks
Share Improve this question asked Feb 7, 2016 at 18:20 Er KK ChopraEr KK Chopra 1,8508 gold badges33 silver badges57 bronze badges1 Answer
Reset to default 8It's
moment(realTime, 'HH:mm').subtract(80, 'minutes');
Or, alternatively, you can use moment.duration
var realTime = '10:15';
var duration = moment.duration({hours: 1, minutes: 20})
var sub = moment(realTime, 'HH:mm').subtract(duration).format();
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743914330a4528914.html
评论列表(0条)