Skip to content

Commit c89f245

Browse files
committed
Create 1358.日期之间隔几天.js
1 parent 0dbc4d3 commit c89f245

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

1358.日期之间隔几天.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @param {string} date1
3+
* @param {string} date2
4+
* @return {number}
5+
*/
6+
var daysBetweenDates = function(date1, date2) {
7+
const a = new Date(date1);
8+
const b = new Date(date2);
9+
return Math.abs((a.getTime() - b.getTime()) / (1000 * 60 * 60 * 24));
10+
};

0 commit comments

Comments
 (0)