当前位置: 首页 > 网络学院 > 客户端脚本教程 > VBScript > VBScript DateDiff 函数
The DateDiff function returns the number of intervals between two dates.
DateDiff函数可以返回两个日期之间的时间间隔。
DateDiff(interval,date1,date2[,firstdayofweek[,firstweekofyear]]) |
参数 | 描述 |
---|---|
interval | Required. The interval you want to use to calculate the differences between date1 and date2 必选项。用于计算 date1 和 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 />") 输出: 1/14/2002 |
document.write(Date & "<br />") 输出: 1/14/2002 |
'当前日期与 10/10/2002相比相差多少周(从星期一开始) 输出: 1/14/2002 |