sql datediff函数
DATEDIFF subtracts the first date from the second date.
The syntax for DATEDIFF is:
DATEDIFF ( datepart , startdate , enddate )
The first datepart code uses the same datepart codes as dateadd.
The second and third arguments are the date values that are part of the subtraction.
例子:
4>
5> SELECT DATEDIFF(DY,"08/30/97","10/01/97")
6> GO
-----------
32
(1 rows affected)
1>