To Calculate workdays between 2 dates (DateTime)

To Calculate workdays between 2 dates I have used function calworkdays. But the days are not getting calculated properly.

I need to get workdays between dates 7/17/2018 9:06 pm and 7/18/2018 8:41 pm, which should come as 1 but I am getting 2.

So, basically I want to consider not only the date but also the time to know the days between 2 dates.

  Discussion posts and replies are publicly visible

Parents
  • Hi,
    calworkdays() function will include both the days so that's why it is returning 2.
    May be you can do like this..> Subtract 1 from the result.
    calworkdays(datetime(2018, 7, 17, 09, 06, 0), datetime(2018, 7, 18, 08, 41, 0))-1
    OR
    Simply subtract date 1 from date 2
    May be you can try like this pv!date2-pv!date1

    Hope this helps.

    Regards
    Aswini
Reply
  • Hi,
    calworkdays() function will include both the days so that's why it is returning 2.
    May be you can do like this..> Subtract 1 from the result.
    calworkdays(datetime(2018, 7, 17, 09, 06, 0), datetime(2018, 7, 18, 08, 41, 0))-1
    OR
    Simply subtract date 1 from date 2
    May be you can try like this pv!date2-pv!date1

    Hope this helps.

    Regards
    Aswini
Children
No Data