Hi,
Got some issue with TimeSpan resulting in wrong duration for task.
For every 1 day we pass to the TimeSpan the resulted duration is 3 working days. And also for every 8 hours it converts into 1 day. Is there any way around if we want to use 24 hrs time span because we think aspose.tasks take 8 hrs as 1 day.
T1.Start = new DateTime(2015, 3, 9,8,0,0);
TaskLink t1_t2 = new TaskLink(T1, T2, TaskLinkType.FinishToStart);
Task1.Duration=new TimeSpan(0,6,24,0);
Task2.Duration=new TimeSpan(3,4,48,0);
Console.WriteLine(Task1.Name + " Start: " + Task1.Start);
Console.WriteLine(Task2.Name + " Finish: " + Task2.Finish);
//I am getting the Finish date of Task1 correct
//but for task2 its giving unexpected finish Date, in place of that we need finish date as (03/12/2015)
Whenever I'm trying to assign 3 days to task2 its taking as 9 days(3*24). And Aspose.Task a=considers
8hrs as 1 day. But as the TimeSpan returns
Hi Waqas,
I converted the days into total hours. And divided it by 3.
Now I can get the correct data.
T1.Duration = TimeSpan.FromHours(ConvertToTotalHours(1, 0, 0, 0));
And
public static Double ConvertToTotalHours(Double Days, Double Hours, Double Minutes, Double Seconds)
{
Double hours = (Days * 24) + (Minutes / 60) + (Seconds / 3600);
return (hours / 3) + Hours;
}
Hi,
Thank you for the feedback and please write to us for any further queries.