DATEDIFF() — Returns the difference between two timestamps as an integer.
DATEDIFF( time-unit, timestamp, timestamp )
The DATEDIFF() function returns an integer value representing the difference between two timestamps for the specified time unit. Specifically, the second timestamp minus the first timestamp, measured in the specified unit. Note that both timestamps are converted to the specified time unit before the subtraction occurs. So, for example, the difference between Dec-31-1999 11:59 and Jan-01-2000 01:01 measured in days would be 1 day, but in hours it would be 2 hours, and in minutes 62 minutes.
The valid time unit keywords are:
MICROSECOND (or MICROS)
MILLISECOND (or MILLIS)