Add TimeSpan to Date : TimeSpan « Date Time « VB.Net Tutorial






Option Strict On

Public Class DateMembers
   Public Shared Sub Main()
      Dim dat As Date = New Date(2000, 1, 1)
      Dim ts As New TimeSpan(30, 0, 0, 0)
      Console.WriteLine("The original date is " & dat)

      dat = dat.AddMonths(5)
      Console.WriteLine("The new date is " & dat)

      dat = dat + ts
      Console.WriteLine("The new date is " & dat)
   End Sub
End Class
The original date is 01/01/2000
The new date is 01/06/2000
The new date is 01/07/2000








5.9.TimeSpan
5.9.1.Add TimeSpan to Date
5.9.2.TimeSpan and Date Substract
5.9.3.Date different parts
5.9.4.Day of the week
5.9.5.Ticks times value