Enum TimeUnitType

TimeUnitType enumeration

Specifies the type of a time unit.

public enum TimeUnitType : sbyte

Values

NameValueDescription
Undefined-1Indicates Undefined value means that the field was not defined in original project file.
Minute0Indicates Minute time unit type.
ElapsedMinute1Indicates Elapsed minute time unit type.
Hour2Indicates Hour time unit type.
ElapsedHour3Indicates Elapsed hour time unit type.
Day4Indicates Day time unit type.
ElapsedDay5Indicates Elapsed day time unit type.
Week6Indicates Week time unit type.
ElapsedWeek7Indicates Elapsed week time unit type.
Month8Indicates Month time unit type.
ElapsedMonth9Indicates Elapsed month time unit type.
Percent10Indicates Percent time unit type.
ElapsedPercent11Indicates Elapsed percent time unit type.
Null12Indicates Null time unit type.
MinuteEstimated13Indicates Minute estimated time unit type.
ElapsedMinuteEstimated14Indicates Elapsed minute estimated time unit type.
HourEstimated15Indicates Hour estimated time unit type.
ElapsedHourEstimated16Indicates Elapsed hour estimated time unit type.
DayEstimated17Indicates Day estimated time unit type.
ElapsedDayEstimated18Indicates Elapsed day estimated time unit type.
WeekEstimated19Indicates Week estimated time unit type.
ElapsedWeekEstimated20Indicates Elapsed week estimated time unit type.
MonthEstimated21Indicates Month estimated time unit type.
ElapsedMonthEstimated22Indicates Elapsed month estimated time unit type.
PercentEstimated23Indicates Percent estimated time unit type.
ElapsedPercentEstimated24Indicates Elapsed percent estimated time unit type.
Year25Indicates Year time unit type.

Remarks

While exporting into XML the Undefined values will be eliminated from resulting XML.

Examples

Shows how to convert a duration into different time unit types.

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

// Get a task to calculate its duration in different formats
var task = project.RootTask.Children.GetById(1);

// Get the duration in Minutes, Days, Hours, Weeks and Months
var mins = task.Get(Tsk.Duration).Convert(TimeUnitType.Minute).ToDouble();
Console.WriteLine("Duration in Mins: {0}", mins);
var days = task.Get(Tsk.Duration).Convert(TimeUnitType.Day).ToDouble();
Console.WriteLine("Duration in Days: {0}", days);
var hours = task.Get(Tsk.Duration).Convert(TimeUnitType.Hour).ToDouble();
Console.WriteLine("Duration in Hours: {0}", hours);
var weeks = task.Get(Tsk.Duration).Convert(TimeUnitType.Week).ToDouble();
Console.WriteLine("Duration in Weeks: {0}", weeks);
var months = task.Get(Tsk.Duration).Convert(TimeUnitType.Month).ToDouble();
Console.WriteLine("Duration in Months: {0}", months);

See Also