Add or subtract time in SQL Server

I have a time in format 08:40
i ll like to add or subtract 60 minutes to that time in sql server

08:40 + sixty munites
08:40 - sixty munites
peterslove53Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Use DATEADD

Declare @time time = '08:40'
SELECT DATEADD(hour, -1, @time), DATEADD(hour, 1, @time)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AielloJCommented:
peterslove53:

Is your starting time (08:40) in a date or time format, or text?

AielloJ
0
peterslove53Author Commented:
time is just an int
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>I have a time in format 08:40
>time is just an int
Explain for us how the value '08:40' can be assigned to an int data type.
0
peterslove53Author Commented:
its data type "Time"
0
AielloJCommented:
peterslove53:

If it's type "time", then Jim Horn's initial response should do what you want.

AielloJ
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.