TimeSpan to double:
1: value.TotalSeconds
TimeSpan to hh : mm : ss Format:
1: String.Format(@"{0:hh\:mm\:ss}", value)
TimeSpan (string double) to hh : mm : ss Format:
1: Int64 totalsec = System.Convert.ToInt64(value);
2:
3: long hour = (long)totalsec / 3600L;
4: long minute = (long)Math.Max(0, (totalsec - hour * 3600) / 60);
5: long second = (long)Math.Max(0, totalsec - hour * 3600 - minute * 60);
6:
7: String strvalue = hour.ToString() + ":" + minute.ToString() + ":" + second.ToString();
沒有留言:
張貼留言