Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function calculates the working days between two date or dateTime objects. It returns the number of full working days between two dates or dateTimes, inclusive. The default working days are Monday, Tuesday, Wednesday, Thursday and Friday. This default can be overridden by supplying a list with alternative working days.

Valid types for period are:

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

  • WEEKS

  • MONTHS

  • YEARS

Syntax

Code Block
WORKINGDAYS BETWEEN date1startDate AND date2WORKINGDAYSendDate
WORKINGDAYS_BETWEEN ( date1startDate, date2endDate, workingDays )
  • date1 - The date or dateTime value that represents the start date.

  • date2 - The date or dateTime value that represents the end date.

  • workingDays - A list containing alternative working days. Note that the days should be specified as returned by the DAYOFWEEK Date and Time functions [9.6] function, e.g. Sunday = 1, Monday = 2 etc.

UI Text Box
typenote

You can use the periods HOURS, MINUTES and SECONDS only if at least one of the dates is a dateTime object or expression.

UI Text Box
typenote

The order in which the dates are placed is irrelevant. The order in which the dates are placed is irrelevant. YEARS BETWEEN date1 AND date2 = YEARS BETWEEN date2 AND date1

Return type

  • integer

UI Text Box
typenote

If you prefer a functional syntax, you can call these methods as: period_BETWEEN(date or datetime, date or datetime). For example: DAYS_BETWEEN(TODAY, UserInput.Date)

Examples

Examples

  • WORKINGDAYS BETWEEN DATE( 2015 , 1 , 1 ) AND DATE( 2015 , 2 , 1 ) = 22

  • WORKINGDAYS_BETWEEN ( DATE ( 2015

  • DAYS BETWEEN DATE( 2010
  • , 1 , 1 )

  • AND
  • , DATE (

  • 2010 , 2 , 1 ) = 31
  • 2015 , 2 , 1 ) , [ 3, 4, 5, 6, 7 ] ) = 23 (work week Tuesday - Saterday)

  • WORKINGDAYS

  • DAYS_BETWEEN ( DATE ( 2010 2015 , 1 , 1 ) , DATE ( 2010 2015 , 2 , 1 ) ) = 31

  • DAYS BETWEEN DATE ( 2010 , 5 , 31 ) AND DATE ( 2010 , 6 , 1 ) = 1
  • , [ 2, 3, 4, 5 ] ) = 17 (4 day work week Monday - Thursday)

  • DAYS BETWEEN DATE( 2010 , 5 , 31 ) AND DATETIME ( 2010 , 6 , 1 , 12 , 0 , 0 ) = 1, since 1 day and 12 hours have elapsed

  • DAYS BETWEEN DATETIME ( 2010 , 1 , 1 , 14 , 0 , 0 ) AND DATETIME ( 2010 , 1 , 2 , 13 , 0 , 0 ) = 0, for only 23 hours have elapsed

  • YEARS BETWEEN DATE ( 2009 , 1 , 1 ) AND DATE ( 2010 , 1 , 1 ) = 1

  • YEARS BETWEEN DATE ( 2010 , 1 , 1 ) AND DATE ( 2020 , 1 , 1 ) = 10

  • YEARS BETWEEN DATE ( 2010 , 1 , 1 ) AND DATE ( 2011 , 5 , 1 ) = 1

  • YEARS BETWEEN DATETIME ( 2010 , 1 , 1 , 12 , 0 , 0 ) AND DATE ( 2011 , 1 , 1 ) = 0, since 364 days and 12 hours have elapsed

 

Include Page
_nav_BackToTop
_nav_BackToTop

...