Get dates of last number of weekdays
Import
·
Mar 18, 2022
·
article
Below code is helpful in providing list of weekday dates and can be used in dynamic filters
var num = 7;
var dateList = [];
for(var i=0;i<num ;i++){
var date = new GlideDate();
date.setValue(((''+gs.daysAgo(i+1)).split(" "))[0]);
var day = date.getByFormat('EEEE');
if(day != "Saturday" && day != "Sunday"){
dateList.push(date.getValue());
}else{
num ++;
}
}
View original source
https://www.servicenow.com/community/developer-blog/get-dates-of-last-number-of-weekdays/ba-p/2287084