DateAdd Function in VB.NET

How to use DateAdd Function?

Explanation

DateAdd Function

DateAdd Function in Visual Basic.net 2008 is used to returns a date with a date,time value added with a specified time intreval.
Syntax:

DateAdd(interval, number, date)
Example:

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs)Handles MyBase.Load
MsgBox("10 Days after the current date is::"
& DateAdd(DateInterval.Day, 10, Now))
End Sub
End Class

In the above DateAdd Function example, a date is added after an intreval of 10 days to the current date value.

Visual Basic Tutorial


Ask Questions

Ask Question