From http://www.w3schools.com (Copyright Refsnes Data)
Complete VBScript Reference
The DateDiff function returns the number of intervals between two dates.
| DateDiff(interval,date1,date2[,firstdayofweek[,firstweekofyear]]) |
| Parameter | Description |
|---|---|
| interval | Required. The interval you want to use to calculate the
differences between date1 and date2 Can take the following values:
|
| date1,date2 | Required. Date expressions. Two dates you want to use in the calculation |
| firstdayofweek | Optional. Specifies the day of the week. Can take the following values:
|
| firstweekofyear | Optional. Specifies the first week of the year. Can take the following values:
|
|
document.write(Date & "<br />") document.write(DateDiff("m",Date,"12/31/2002") & "<br />") document.write(DateDiff("d",Date,"12/31/2002") & "<br />") document.write(DateDiff("n",Date,"12/31/2002")) Output: 1/14/2002 11 351 505440 |
|
document.write(Date & "<br />") 'Note that in the code below 'is date1>date2 document.write(DateDiff("d","12/31/2002",Date)) Output: 1/14/2002 -351 |
|
'How many weeks (start on Monday), 'are left between the current date and 10/10/2002 document.write(Date & "<br />") document.write(DateDiff("w",Date,"10/10/2002",vbMonday)) Output: 1/14/2002 38 |
Complete VBScript Reference
From http://www.w3schools.com (Copyright Refsnes Data)