Skip to end of banner
Go to start of banner

getWorkingInterval

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Availability

This routine is available starting with katl-commons 2.5.

Syntax

getWorkingInterval(startDate, endDate, startWorkingHour, endWorkingHour, weekendDays, holidays)

Description


Returns the number of working hours from a time interval.

Parameters

ParameterTypeRequiredDescription
startDateDateYesthe start working date
endDateDateYesthe end working date
startWorkingHourStringYesthe daily start working hour (HH:mm)
endWorkingHourStringYesthe daily end working hour (HH:mm)
weekendDaysNumber arrayYesthe weekend days (day of week)
holidaysDate arrayYesthe dates of the free days

Return type

number

The returned number represents the working hours from the given time interval.

Example

number hours;
date startDate = "2012-01-10 12:00:00";
date endDate = "2012-01-20 10:30:00";
string startHour = "09:00";
string endHour = "17:00";
number[] weekend = {7, 1};
date[] holidays = {"2012-01-18", "2012-01-16"};

hours = getWorkingInterval(startDate, endDate, startHour, endHour, weekend, holidays);

Returns the number of working hours from 2012-01-10 12:00 to 2012-01-20 10:30, excluding the weekends (7 is Saturday and 1 is Sunday) and holidays (2012-01-18 and 2012-01-16).

 

See also


  • No labels