DateTime.Subtract : DateTime « System « VB.Net by API






DateTime.Subtract

  

public class Test
  
   public Shared Sub Main
        Dim start_time As DateTime
        Dim stop_time As DateTime
        Dim elapsed_time As TimeSpan

        Dim num_items As Integer = 10000

        Dim array1(0 To num_items - 1) As Integer
        start_time = Now
        For i As Integer = 0 To num_items - 1
            array1(i) = i
        Next i
        stop_time = Now
        elapsed_time = stop_time.Subtract(start_time)
        Console.WriteLine(elapsed_time.TotalSeconds())


        Erase array1

   End Sub
   
End class

   
    
  








Related examples in the same category

1.New DateTime
2.DateTime.DayOfWeek
3.DateTime.IsLeapYear
4.DateTime.Second
5.DateTime.ToUniversalTime()
6.DateTime.UtcNow()
7.DateTime.Year