Windows – Linux – Mac OSX Guides

Count the business days in XPages

There’s no @Businessdays formula function available in XPages, so if you have to count the business days between two date time values, you will have to implement your own way. Here’s the SSJS snippet that I have written to do the functionality of @Businessdays in case and anyone might need

Lotus notes domino

Tagged with:     , ,

Related Articles

Loading Facebook Comments ...

2 Comments

  1. rohit

    This is failing, I have the begin date as 24 dec 2013 and end date is 7 jan 2014. It is resulting in zero.

  2. Salvatore

    Hello I change just a bit the code in this way it is working fine
    var dCount:NotesDateTime = session.createDateTime( getComponent(“startDate”).getValue() );
    var dEnd:NotesDateTime = session.createDateTime( getComponent(“endDate”).getValue() );
    var difference = null;
    difference = dEnd.timeDifference(dCount);
    difference = (Math.floor(difference/86400)) + 1;
    var noDays:Integer = 0;
    var dWeek:Integer = 0;
    for (i = 0; i < difference; i++) {
    dWeek = @Weekday(dCount.getDateOnly());
    if (!(dWeek == 1 || dWeek == 7))
    {
    noDays++;
    }
    dCount.adjustDay(1);
    }

    return noDays;

Post your comments

Your email address will not be published. Required fields are marked *