Search This Blog

Wednesday, March 19, 2014

DateDiff Visual Basic Example

VB.NET Functions > DateDiff

Returns a value specifying the number of time intervals 
between two dates.

Example:


Dim dt1 As Date = #3/1/2014#
Dim dt2 As Date = #4/1/2014#

MessageBox.Show("Day diff: " & DateDiff(DateInterval.Day, dt1, dt2) & " Week diff: " & DateDiff(DateInterval.Weekday, dt1, dt2))