1.

How To Work With Timespan Class?

Answer»

VB.NET
DIM ADATE As DateTime = DateTime.Parse("06/24/2003")
Dim bdate As DateTime = DateTime.Parse("06/28/2003")
Dim ts As NEW TimeSpan(bdate.Ticks - adate.Ticks)
Response.Write(ts.TotalDays & "")
Response.Write(ts.TotalHours & ":" & ts.TotalMinutes & ":" & ts.Total SECONDS & ":" & ts.TotalMilliseconds)

C#
DateTime adate = DateTime.Parse("06/24/2003");
DateTime bdate = DateTime.Parse("06/28/2003");
TimeSpan ts = new TimeSpan (bdate.Ticks - adate.Ticks);
Response.Write(ts.TotalDays.ToString () + "");
Response.Write(ts.TotalHours.ToString() + ":" + ts.Total Minutes. ToString() + ":" + ts.Total Seconds.ToString() + ":" + ts.Total Milli seconds.ToString() );

VB.NET
Dim adate As DateTime = DateTime.Parse("06/24/2003")
Dim bdate As DateTime = DateTime.Parse("06/28/2003")
Dim ts As New TimeSpan(bdate.Ticks - adate.Ticks)
Response.Write(ts.TotalDays & "")
Response.Write(ts.TotalHours & ":" & ts.TotalMinutes & ":" & ts.Total Seconds & ":" & ts.TotalMilliseconds)

C#
DateTime adate = DateTime.Parse("06/24/2003");
DateTime bdate = DateTime.Parse("06/28/2003");
TimeSpan ts = new TimeSpan (bdate.Ticks - adate.Ticks);
Response.Write(ts.TotalDays.ToString () + "");
Response.Write(ts.TotalHours.ToString() + ":" + ts.Total Minutes. ToString() + ":" + ts.Total Seconds.ToString() + ":" + ts.Total Milli seconds.ToString() );



Discussion

No Comment Found