Answers for "moment js subtract dates"

3

moment subtract days

var startdate = moment();
startdate = startdate.subtract(1, "days");
startdate = startdate.format("DD-MM-YYYY");
Posted by: Guest on July-01-2020
1

how 2 subtract 2 dates using moment.js

var date1 = moment('2016-10-08 10:29:23');
var date2 = moment('2016-10-08 11:06:55');
var diff = date2.diff(date1);
Posted by: Guest on February-23-2021
1

moment js subtract years

let min_date = moment().subtract(18, 'years');
Posted by: Guest on November-19-2020

Browse Popular Code Answers by Language