MESCIUS.ActiveReports.Core.Data.VBFunctionLib Assembly / GrapeCity.Enterprise.Data.VisualBasicReplacement Namespace / DateAndTime Class / DateDiff Method / DateDiff(DateInterval,DateTime,DateTime,FirstDayOfWeek,FirstWeekOfYear) Method
Required. A DateInterval enumeration value or a string expression representing the time interval you want to use as the unit of difference between Date1 and Date2.
Required. Date. The first date/time value you want to use in the calculation.
Required. Date. The second date/time value you want to use in the calculation.
Optional. A value chosen from the FirstDayOfWeek enumeration that specifies the first day of the week. If not specified, FirstDayOfWeek.Sunday is used.
Optional. A value chosen from the FirstWeekOfYear enumeration that specifies the first week of the year. If not specified, FirstWeekOfYear.Jan1 is used.

DateDiff(DateInterval,DateTime,DateTime,FirstDayOfWeek,FirstWeekOfYear) Method
Returns a Long value specifying the number of time intervals between two Date values.
Syntax
'Declaration
 
Public Overloads Shared Function DateDiff( _
   ByVal interval As DateInterval, _
   ByVal date1 As Date, _
   ByVal date2 As Date, _
   Optional ByVal dayOfWeek As FirstDayOfWeek, _
   Optional ByVal weekOfYear As FirstWeekOfYear _
) As Long
 

Parameters

interval
Required. A DateInterval enumeration value or a string expression representing the time interval you want to use as the unit of difference between Date1 and Date2.
date1
Required. Date. The first date/time value you want to use in the calculation.
date2
Required. Date. The second date/time value you want to use in the calculation.
dayOfWeek
Optional. A value chosen from the FirstDayOfWeek enumeration that specifies the first day of the week. If not specified, FirstDayOfWeek.Sunday is used.
weekOfYear
Optional. A value chosen from the FirstWeekOfYear enumeration that specifies the first week of the year. If not specified, FirstWeekOfYear.Jan1 is used.

Return Value

Returns a Long value specifying the number of time intervals between two Date values.
Exceptions
ExceptionDescription
The exception that is thrown when one of the arguments provided to a method is not valid.
See Also