Sunday 21 February 2016

Time calcularion

 string[] ss = outgoingCallSummaryDetails.Time.Split(':');
                        h = Convert.ToInt32(ss[0]) + DateTime.UtcNow.Subtract(outgoingCallSummaryDetails.UpdatedDate.Value).Hours;
                        mm = Convert.ToInt32(ss[1]) + DateTime.UtcNow.Subtract(outgoingCallSummaryDetails.UpdatedDate.Value).Minutes;
                        s = Convert.ToInt32(ss[2]) + DateTime.UtcNow.Subtract(outgoingCallSummaryDetails.UpdatedDate.Value).Seconds;
                        total = (h * 3600) + (mm * 60) + s;
                        h = total / 3600;
                        mm = (total % 3600) / 60;
                        s = (total % 3600) % 60;
                        outgoingSummary.Time = h.ToString() + ":" + mm.ToString() + ":" + s.ToString();

No comments:

Post a Comment