These first function snippets are from https://gist.github.com/W3BGUY // function to figure out the number of days in month. function getDaysInMonth(thisMonth,thisYear){ var monthArray=[31,28,31,30,31,30,31,31,30,31,30,31]; if(thisMonth!=2){return monthArray[thisMonth-1]}; if(thisYear%4!=0){return monthArray[1]}; if(thisYear%100==0 && thisYear%400!=0){return monthArray[1]}; return monthArray[1]+1; } // NetSuite usage example nlapiLogExecution(‘DEBUG’,getDaysInMonth(11,2016)) // function to add leading zeros on date parts. function zeroPad(num,len){ var…