Skip to content
Advertisement

How to add date and time in SQL Server

I have two variables @date of type datetime and @time of type time. I want to add both to get another datetime variable. And I want to perform further calculations on it.

Ex:

I want something like this

Is there any way?

Advertisement

Answer

You can tranform your time to seconds and add them to your datetime value:

Output:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement