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
It'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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With