Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Number of business days between two dates with custom bcal

    I'm trying to calculate the number of work days (school days) between two dates using a custom calendar. I cannot simply format with %tb because I have start and end dates that are not defined by the calendar (non-school days). For example, if startdate is a Saturday and enddate is Friday, but Wednesday is a school holiday, I'd like to count only Monday, Tuesday, Thursday, Friday (=4).

    I have found the workdays command, but that does not seem to use a bcal to define holidays/workdays.

    Thanks for the help!

  • #2
    Hello Jonathan,

    I cannot simply format with %tb because I have start and end dates that are not defined by the calendar (non-school days).
    How are you trying to "format with %tb"? Are you using a business calendar file and the function bofd()? Also, I am not sure what you mean by start and end dates are not defined by the calendar. Please note that you can edit your bcalname.stbcal file (or create a new one altogether) to extend the range or add holidays. You can also use bcal create to create a business calendar from a dataset (the holidays will be inferred).

    If this does not help, can you give an example with code and data (maybe using dataex), as well as the contents of your business calendar file?

    -- Kreshna

    Comment

    Working...
    X