Set ExpectedDuration based on DueDate when ProcessInstance starts
TimeSpan timespan = (DateTime.Now - DueDate);
K2.ProcessInstance.ExpectedDuration = Math.Abs(timespan.TotalMinutes);
Update: After it's set, the expected duration remained 0 in the ViewFlow 4.6.6 for the Process but the number is there in ProcInst table.
Calculation DueDate based on duration from StartDate
System.TimeSpan duration = new System.TimeSpan(0, 0, K2.ProcessInstance.ExpectedDuration, 0);
DueDate = StartDate.Add(duration);
or
SELECT startdate, DATEADD(minute, expectedDuration, startDate) DueDate
FROM MK2Server].]Server].]ProcInst]