Free Support Forum -

DefaultHoursInDay- hardcoded to 8 in Aspose?

I have a Microsoft Project 2003 file that has hours per day of 24.

I have defined a task with a duration of 120 days.

Loading this file into Aspose.Tasks shows the duration as 360 days. DefaultSettings shows the correct DefaultHoursInDay of 24.

Is Aspose hardcoded to use 8 hours per day? Is there a property that I can use to adjust the values as seen in the aspose object model?


Dan H.

Dear Dan,

Sorry for delay, we were investigating this behavior.
Yes, by default project have 8 hour per day and 40 hours per week.
You can change it in the DefaultSettings class but really these values doesn’t work.

MS Project get real values of hours per day from Calendar only.
If you set in a calendar 24 work hours then you will get duration of task 120 days.

here is the code I am using to adjust. Please let me know if I have anything wrong.

double adjustedValue = duration.Value;

double assumedHoursInDay = 8;
double assumedDaysInWeek = 5;
double assumedDaysInMonths = 20;
switch (duration.ValueType)
case Aspose.Tasks.TimeUnit.Percent:
case Aspose.Tasks.TimeUnit.ElapsedPercent:
adjustedValue = duration.Value;
case Aspose.Tasks.TimeUnit.ElapsedMinutes:
case Aspose.Tasks.TimeUnit.Minutes:
adjustedValue = duration.Value;
case Aspose.Tasks.TimeUnit.Hours:
case Aspose.Tasks.TimeUnit.ElapsedHours:
adjustedValue = duration.Value;
case Aspose.Tasks.TimeUnit.Days:
case Aspose.Tasks.TimeUnit.ElapsedDays:
adjustedValue = duration.Value / (asposeFile.DefaultSettings.DefaultHoursInDay / 8);
case Aspose.Tasks.TimeUnit.Weeks:
case Aspose.Tasks.TimeUnit.ElapsedWeeks:
adjustedValue = (duration.Value * assumedDaysInWeek * assumedHoursInDay) / asposeFile.DefaultSettings.DefaultHoursInWeek;
case Aspose.Tasks.TimeUnit.Months:
case Aspose.Tasks.TimeUnit.ElapsedMonths:
adjustedValue = (duration.Value * assumedDaysInMonths * assumedHoursInDay) / (asposeFile.DefaultSettings.DefaultDaysInMonth * asposeFile.DefaultSettings.DefaultHoursInDay);
case Aspose.Tasks.TimeUnit.ElapsedYears:
case Aspose.Tasks.TimeUnit.Years:
adjustedValue = duration.Value;
adjustedValue = duration.Value;

Is this something that will be fixed in the future?



I didn’t try it of course but code looks correct. At least for 24 hours per day.
I will check if we can add reading of durations based on calendars in a short time.

Hello Dan,

We added reading duration values based on DefaultHours* and DefaultDays* properties in 1.6.1 hot fix.