Project.GetDuration
GetDuration(double)
Gets Duration
object with the specified number of units and default duration format which is defined in project’s settings DurationFormat
.
public Duration GetDuration(double val)
Parameter | Type | Description |
---|---|---|
val | Double | specified number of units. |
Return Value
Duration object.
Remarks
This method should be used carefully because it returns different durations depending on Project.DurationFormat setting. For example, GetWork(1.0) will return 1 hour when Project.DurationFormat is TimeUnitType.Hour or 1 day if Project.DurationFormat is TimeUnitType.Day.
Examples
Shows how to create a <see cref=“Aspose.Tasks.Duration” /> instance with default project’s duration format by using project fabric methods.
var project = new Project();
// get a duration with default project format.
var duration = project.GetDuration(1);
Console.WriteLine("Default project duration time unit type: " + project.Get(Prj.DurationFormat));
Console.WriteLine("Created duration time unit type: " + duration.TimeUnit);
See Also
- struct Duration
- class Project
- namespace Aspose.Tasks
- assembly Aspose.Tasks
GetDuration(double, TimeUnitType)
Gets Duration
object with the specified number of TimeUnitType
units.
public Duration GetDuration(double val, TimeUnitType timeUnit)
Parameter | Type | Description |
---|---|---|
val | Double | specified number of units. |
timeUnit | TimeUnitType | specified TimeUnitType value. |
Return Value
Duration object.
Examples
Shows how to create a <see cref=“Aspose.Tasks.Duration” /> instance by using project fabric methods.
var project = new Project();
// get a duration with default project format.
var duration = project.GetDuration(1, TimeUnitType.Minute);
Console.WriteLine("Created duration: " + duration);
See Also
- struct Duration
- enum TimeUnitType
- class Project
- namespace Aspose.Tasks
- assembly Aspose.Tasks
GetDuration(TimeSpan, TimeUnitType)
Gets Duration
object with the specified TimeSpan value and specified TimeUnitType
value.
public Duration GetDuration(TimeSpan timeSpan, TimeUnitType timeUnit)
Parameter | Type | Description |
---|---|---|
timeSpan | TimeSpan | specified TimeSpan value. |
timeUnit | TimeUnitType | specified TimeUnitType value. |
Return Value
Duration object.
See Also
- struct Duration
- enum TimeUnitType
- class Project
- namespace Aspose.Tasks
- assembly Aspose.Tasks