I have two dates and I want to find no. of days between these dates excluding Sunday. I tried it using bizdays() but it doesn't seem to be giving correct output.
Here is what I've tried.
library(bizdays)
#Dates are in Y-m-d format
Start_Date <- "2017-11-21"
End_Date <- "2017-12-03"
create.calendar("FOSCal", holidays = integer(0), weekdays = c("sunday"),
start.date = Start_Date, end.date = End_Date, adjust.from = adjust.none,
adjust.to = adjust.none)
FOS_Days <- as.integer(bizdays(Start_Date, End_Date, "FOSCal"))
This code is giving me output as 10 whereas it should give 11. I think it has something to do with EndDate because it is Sunday but not sure. Could anyone please let me know what I'm missing here?
We can create a sequence based on the
Start_Date
andEnd_Date
, use `weekdays function to get weekdays, and then exclude Sunday and count the length of the sequence. The following code shows the answer is 11.