Enumeration of dates between 'startdate' and 'enddate' using Custom function
frequently working schedule
we need to view dates between startdate and enddate.
[date type data]
[formular]
we can extract dates from working duration without adding any repeated codes.
[script]
function dtr( formula ){
if (typeof formula.map === "function"){
return formula.map(dtr);
}else if(formula){
return WriteTermDates(formula);
}
}
function WriteTermDates(d) {
var ss1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("SHEET");
var testDate = new Date("1900/1/1");
var startDate = new Date(testDate.getDate()+parseInt(d.substring(0,5)-25569)24 * 60 * 60 * 1000);
var endDate = new Date(testDate.getDate()+parseInt(d.substring(5,10)-25569)24 * 60 * 60 * 1000);
var values = "";
while(startDate.getDate() <= endDate.getDate()) {
// Logger.log(Utilities.formatDate(startDate, "GMT", "MM-dd"));
values += Utilities.formatDate(startDate, "GMT", "MM-dd") + ", ";
startDate.setDate(startDate.getDate() + 1);
}
return values;
}
Leave Enumeration of dates between 'startdate' and 'enddate' using Custom function to:
Read more #spreadsheet posts
Best Posts From zero6pak
We have not curated any of zero6pak's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From zero6pak
- google query label replacement when using "group by"
- Date Time Replacement In IFTTT with settings and functions
- using query function with importrange
- Enumeration of dates between 'startdate' and 'enddate' using Custom function
- Managing working time using IFFTT (Location based)
- My favorite function ARRAYFORMULA in Google Spreadsheet
- Google Spreadsheet to Google Calendar using Zapier
- eval function in google spreadsheet; multi rows
- Date Time Replacement In IFTTT with google script
- Google spreadsheet data to Google Contact using Zapier