Analytics


Google

Sunday, April 11, 2010

Computing and Displaying elapsed time In vb.net

To compute the elapse time, get the snapshot of the time at the beginning, using Now.TimeOfDay (as shown below) and then substract from the same when it is time to display the elapsed time.

         Dim prgStartTime As TimeSpan = Now.TimeOfDay
         Dim eTime As TimeSpan = Now.TimeOfDay.Subtract(prgStartTime)

         Console.WriteLine("Elasped Time " & eTime.ToString)

No comments: