Skip to main content
Skip table of contents

DateDiffWorkhours

Returns the number of working hours from the first date to the second date.

Syntax

CODE
DateDiffWorkhours(from_date, to_date, nonworkdays, businesshours)

Arguments

from_date

MDX expression that returns a date. Starting date, if it is a workday, will be included in the calculation.

to_date

MDX expression that returns a date. Date until which to count workdays; this day itself will not be included in calculation even if it is a workday.

nonworkdays

Specify a string with non-working day numbers (use 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, 6 for Saturday, and 7 for Sunday).

businesshours

Specify a string with business hours (start and end) in 24-h clock time or 12-h clock time.

Examples

The following example returns a difference in workhours from the Issue created date until resolution if non-working days are Friday and Saturday and working hours are defined from 9 am to 5 pm (incl). That means if the event happened at 5:59 pm it would still be included.

CODE
DateDiffWorkhours([Issue].get('Created at'),
    [Issue].get('Resolved at'), '56', '9-17')

See also

  • Function DateDiffDays which returns the number of days between two dates.

  • Function DateDiffWorkdays which returns the number of workdays between two dates.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.