M
M
mamaanarhiya2018-02-20 16:27:19
JavaScript
mamaanarhiya, 2018-02-20 16:27:19

How to find the number of days between two dates?

There are two dates, how to find out the number of days between them? You can use momentJS. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2018-02-20
@mamaanarhiya

var dateB = moment('2014-11-11');
var dateC = moment('2014-10-11');

console.log('Разница в ', dateB.diff(dateC), 'миллисекунд');
console.log('Разница в ', dateB.diff(dateC, 'days'), 'дней');
console.log('Разница в ', dateB.diff(dateC, 'months'), 'месяцев');

S
sHARek, 2018-02-20
@sHARek

What is diff? o_O

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question