Fix “The datepart … is not supported by date function dateadd for data type date” in SQL Server

If you’re getting error 9810 that reads something like “The datepart hour is not supported by date function dateadd for data type date“, it’s because the datepart that you’re trying to add or subtract a datepart is not supported for the data type of the original value.

This typically happens when you try to add a timepart to a date value. For example, trying to add an hour to a date value will result in this error, because the date type doesn’t support the hour datepart. You can’t have a date value that includes the hour.

To fix this, either change the datepart to one that’s supported, or change the data type of the initial value.

Example of Error

Here’s an example of code that produces the error:

DECLARE @d DATE = '2026-03-24';
SELECT DATEADD(HOUR, 48, @d);

Output:

Msg 9810, Level 16, State 1, Line 2
The datepart hour is not supported by date function dateadd for data type date.

It’s not saying that hour is not supported at all. It’s just saying that it’s not supported for that data type.

Solution

We can fix this issue by either, changing to a supported datepart, or providing the date in the correct data type.

Here’s an example of changing the datepart:

DECLARE @d DATE = '2026-03-24';
SELECT DATEADD(DAY, 2, @d);

Output:

2026-03-26

Here, I changed HOUR to DAY. Obviously, this will only be suitable in some cases. It all depends on how much you’re trying to add or subtract. In the above example, we were initially trying to add 48 hours, which happens to be 2 days. So we could switch to DAY and it worked fine. Bear in mind that we also had to change 48 to 2.

Another option is to either convert the initial value to DATETIME or similar, or set it to that initially:

DECLARE @d DATETIME = '2026-03-24';
SELECT DATEADD(HOUR, 48, @d);

Output:

2026-03-26 00:00:00.000

Basically the same result, except that it’s a DATETIME value. This only makes sense if you really do want a DATETIME value though. For example, it would be useful in the following example:

DECLARE @d DATETIME = '2026-03-24';
SELECT DATEADD(HOUR, 2, @d);

Output:

2026-03-24 02:00:00.000

Here, we added two hours, which requires a DATETIME value in order to show the hour portion.