Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript add business days to date

function add_bus_days(date, busDays) { // add business days to a date
                var wkdy = date.getDay(); // get weekday number
                var addDays = wkdy >= 3 ? (busDays + 2) : busDays; // if it's wednesday or later set add days to 5 instead of 3 to account for the weekend
                date.setDate(date.getDate() + addDays); // add days to current date
                return date
            }
// usage
var dt = new Date(); // get date
newDate = add_bus_days(dt, 3) // add 3 business days
Comment

PREVIOUS NEXT
Code Example
Javascript :: data-widget="pushmenu" collable automatically 
Javascript :: javascript make element invisible 
Javascript :: tostring javascript 
Javascript :: check if js string begin with word 
Javascript :: how to hide all fo the paragraphs in jquery 
Javascript :: datetimepicker set value 
Javascript :: Javascript - check if div contains a word? - Stack Overflow 
Javascript :: protractor element.all for each 
Javascript :: javascript loop over classes 
Javascript :: javascript randomly shuffle array 
Javascript :: get nearest multiple of a number javascript 
Javascript :: jquery first child 
Javascript :: angular cli add sslkey certificate 
Javascript :: jquery is triggered on every element with class name 
Javascript :: js substring 
Javascript :: An accessor cannot be declared in an ambient context. 
Javascript :: js camel case to snake case 
Javascript :: how to get day from javascript date 
Javascript :: deploy react app netlify 
Javascript :: javascript word start with 
Javascript :: how to generate package-lock.json from package.json 
Javascript :: shadow border react native 
Javascript :: show div js 
Javascript :: javascript canvas dot 
Javascript :: get value of checked radio button jquery 
Javascript :: how to know type of dom element in js 
Javascript :: js replace all spaces 
Javascript :: nodejs create buffer from string 
Javascript :: express cors 
Javascript :: redirect the page in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =