The DATEDIFF function returns a number of time units crossed between two specified dates. The function accepts the following three input arguments:
- datepart: This is the time unit (year, quarter, month, second, millisecond, microsecond, and nanosecond)
- startdate: This is an expression of any date data type (date, time, smalldatetime, datetime, datetime2, and datetimeoffset)
- enddate: This is also an expression of any date data type (date, time, smalldatetime, datetime, datetime2, and datetimeoffset)
The return type of the function is int. This means that the maximum returned value is 2,147,483,647. Therefore, if you specify minor units (milliseconds, microseconds, or nanoseconds) as the first parameters of the function, ...