I just want to ask if it is possible to add hours to a parse moment date. I have a code like this:
var myDate = "2017-04-14 07:07:15";
var object_myDate = moment(myDate).format('YYYY-MM-DD hh:mm:ss');
var status = object_myDate.add(5, 'hours');
but this code gives the following error:
object_myDate.add is not a function
add(Duration); moment(). add(Object); Mutates the original moment by adding time. This is a pretty robust function for adding time to an existing moment.
moment(). add(30, 'days');
add(minutes, 'minutes') . format('LTS');
add
is a moment function, you should use on moment object:
var myDate = "2017-04-14 07:07:15";
var status = moment(myDate).add(5, 'hours').format('YYYY-MM-DD hh:mm:ss');
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