Skip to content

Commit 2eac0fd

Browse files
authored
Create week_calculation.js
1 parent 99035e3 commit 2eac0fd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//Determines the number of weeks between the start and end dates
2+
var startDate = new GlideDateTime(<start_date>);
3+
var endDate = new GlideDateTime(<end_date>);
4+
5+
var millisecondsBetween = endDate.getNumericValue() - startDate.getNumericValue();
6+
var weeks = millisecondsBetween / (1000 * 60 * 60 * 24 * 7);
7+
8+
var weeks_roundoff = Math.floor(weeks);
9+
10+
gs.info(weeks_roundoff);

0 commit comments

Comments
 (0)