comp • gb.vb • vb • datediff

Vb.DateDiff (gb.vb)

Static Function DateDiff ( period As String, Date1 As Date, Date2 As Date ) As Integer

Returns the number of periods between two dates. A negative number will mean that date2 is bigger than date1.

Period is a string expression that is the interval to be returned.


yyyy Year
q Quarter
m Month
y Day of year
d Day
w Week day - Note: A week day is Monday to Friday in Gambas. This is different to VB in which w = d
ww Week
h Hour
n Minute
s Second

Date1 and Date2 are the two dates or literals representing dates from which the difference is calculated. Date1 is subtracted from Date2 (which is currently the opposite to VB! :-).