We can use DATEADD() function like below to add hours to DateTime in Sql Server.
DATEADD() functions first parameter value can be hour or hh all will return the same result. Below example shows how we can add two hours to Current DateTime in Sql Server:
DATEADD() functions first parameter value can be hour or hh all will return the same result. Below example shows how we can add two hours to Current DateTime in Sql Server:
SELECT GETDATE() 'Now',
DATEADD(hour,2,GETDATE()) 'Now + 2 Hours'
SELECT GETDATE() 'Now',
DATEADD(hh,2,GETDATE()) 'Now + 2 Hours'
DATEADD(hour,2,GETDATE()) 'Now + 2 Hours'
SELECT GETDATE() 'Now',
DATEADD(hh,2,GETDATE()) 'Now + 2 Hours'