Calendar.GetWorkingHours
Contents
[
Hide
]GetWorkingHours(DateTime, DateTime)
Return working hours for the specified dates.
public WorkUnit GetWorkingHours(DateTime start, DateTime finish)
Parameter | Type | Description |
---|---|---|
start | DateTime | Start date. |
finish | DateTime | Finish date. |
Return Value
Working hours.
Examples
Shows how to get working hours for specific dates.
var project = new Project(DataDir + "Project1.mpp");
var calendar = project.Calendars.GetByUid(1);
// get working hours for specific date
var workUnit = calendar.GetWorkingHours(new DateTime(2020, 4, 8, 8, 0, 0), new DateTime(2020, 4, 9, 17, 0, 0));
// 16 hours will be printed
Console.WriteLine(workUnit.WorkingHours);
See Also
- class WorkUnit
- class Calendar
- namespace Aspose.Tasks
- assembly Aspose.Tasks
GetWorkingHours(DateTime)
Returns amount of working hours at the date.
public TimeSpan GetWorkingHours(DateTime dt)
Parameter | Type | Description |
---|---|---|
dt | DateTime | The date to get working hours for. |
Return Value
Working hours.
Examples
Shows how to get working hours for a specific date.
var project = new Project(DataDir + "Project1.mpp");
var calendar = project.Calendars.GetByUid(1);
// get working hours for specific date
var workingHours = calendar.GetWorkingHours(new DateTime(2020, 4, 10));
// 8 hours will be printed
Console.WriteLine(workingHours.Hours);
See Also
- class Calendar
- namespace Aspose.Tasks
- assembly Aspose.Tasks