Calendar.GetStartDateFromFinishAndDuration
Contents
[
Hide
]GetStartDateFromFinishAndDuration(DateTime, Duration)
Returns StartDate based on specified FinishDate and Duration.
public DateTime GetStartDateFromFinishAndDuration(DateTime finish, Duration duration)
Parameter | Type | Description |
---|---|---|
finish | DateTime | The specified finish date. |
duration | Duration | The specified work duration. |
Return Value
Calculated StartDate.
Examples
Shows how to get a start date by finish date and duration.
var project = new Project(DataDir + "Project1.mpp");
var calendar = project.Calendars.GetByUid(1);
// get start date by finish date and a duration
var startDate = calendar.GetStartDateFromFinishAndDuration(new DateTime(2020, 4, 10, 9, 0, 0), project.GetDuration(16, TimeUnitType.Hour));
// 8 April 2020 9:00 AM will be printed
Console.WriteLine(startDate);
See Also
- struct Duration
- class Calendar
- namespace Aspose.Tasks
- assembly Aspose.Tasks
GetStartDateFromFinishAndDuration(DateTime, TimeSpan)
Returns StartDate based on specified FinishDate and Duration.
public DateTime GetStartDateFromFinishAndDuration(DateTime finish, TimeSpan duration)
Parameter | Type | Description |
---|---|---|
finish | DateTime | The specified finish date. |
duration | TimeSpan | The specified work duration. |
Return Value
Calculated StartDate.
Examples
Shows how to get a start date by finish date and duration (as a time span).
var project = new Project(DataDir + "Project1.mpp");
var calendar = project.Calendars.GetByUid(1);
// get start date by finish date and a duration
var startDate = calendar.GetStartDateFromFinishAndDuration(new DateTime(2020, 4, 10, 9, 0, 0), TimeSpan.FromHours(16));
// 8 April 2020 9:00 AM will be printed
Console.WriteLine(startDate);
See Also
- class Calendar
- namespace Aspose.Tasks
- assembly Aspose.Tasks