DateDiff() |
Top Previous Next |
DateDiff() - Calculate the Difference Between Two Dates Description The DateDiff() function is used to compare two dates and calculate the period between them in days, months, years, hours, minutes or seconds. DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]]) Parameters
The date1 and date2 parameters are used to specify the initial and final dates for comparison. The optional parameter firstdayofweek specifies the [id=44#days]day of the week[/id] to use as the first day. If not specified, Sunday is the default value. The optional firstweekofyear parameter specific the how the [id=44#weeks]first week of the year[/id] is defined. Examples DaysOld = DateDiff("d", "1-Apr-64", Now) You could calculate the number of seconds since New Years Day using this example: SecondsNYD = DateDiff("s", "1-Jan-" & Year(Now), Now) |