@DATEDIFF calculates the difference between two dates or datetimes, in days or seconds.
Syntax
@DATEDIFF ("difference", date, date)
Examples
To calculate the number of days since the beginning of the year 2000:
differential = (@DATEDIFF("DD","2000-01-01",@DATENOW()))
To calculate the actual day of the year in the above example (@DATEDIFF returns 0 for 2000-01-01):
todays_day = @COMPUTE(@DATEDIFF("DD","2000-01-01",@DATENOW()))+1)