How to add time and date in vb.net

How to add time and date in vb.net
Here’s an example of using the AddDays method,Similarly, you can use AddMinutes, AddHours, AddSeconds, AddMilliseconds,AddMonths, AddYears
======================================================================================= Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ti As Date = TimeOfDay 'the current time
Dim da As Date = Today 'the current date
Dim a As String = "the current date is" + da + vbCrLf
Dim dati As Date = Now 'the current date and time
da = da.AddDays(12) ' add 12 days
a = a + "12 days from now is:" & da + vbCrLf
a = a + "the current date" & ti + vbCrLf
ti = ti.AddHours(2) 'add 2 hr
a = a + "2 hr from now is:" & ti + vbCrLf
MessageBox.Show(a)
End Sub
=====================================================================================

No comments: