CountWeekdays

The CountWeekdays function returns the number of weekdays between two date input parameters.

Syntax

CountWeekdays(<input_1>, <input_2>)

Where input_1 and input_2 are of one of the following data types:

  • instant
  • date_time
  • date
  • offset_date_time
  • zoned_date_time

Return Type

Integer

Details

The count value returned is inclusive of both input dates.

Examples

select pt.name,
per.name,
start_date, 
end_date,
CountWeekdays(start_date, end_date) as weekday_count
from xactly.xc_period per
join xactly.xc_period_type pt on pt.period_type_id = per.period_type_id_fk
order by per.start_date, per.end_date;

select CountWeekdays(ToDate('2017-02-01'), ToDate('2017-02-07'))
from Empty();

Related Functions

DiffDays

DiffTime

AddDays

SubtractDays