Calendar.GetWorkingTimes

Calendar.GetWorkingTimes method

Returns WorkingTimeCollection of working times for the specified date.

public WorkingTimeCollection GetWorkingTimes(DateTime dt)
ParameterTypeDescription
dtDateTimeThe date to get working times for.

Return Value

List of WorkingTime.

Examples

Shows how to get working times for a specific date.

var project = new Project(DataDir + "Project1.mpp");

var calendar = project.Calendars.GetByUid(1);

// get working times for specific date
var workingTimes = calendar.GetWorkingTimes(new DateTime(2020, 4, 8, 8, 0, 0));

// 16 hours will be printed
foreach (var workingTime in workingTimes)
{
    Console.WriteLine("From: " + workingTime.From);
    Console.WriteLine("To: " + workingTime.To);
}

See Also