Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

minute problem

Status
Not open for further replies.

baran121

Programmer
Sep 8, 2005
337
TR
Hello everybody,

i use sql server 2000 in my project.
i want to get start time with minute and end time?
for an example:

minute :150 minutes
end time: 18:30

i want to know start time with a code?
start time: 14:00 how can i get this?

please help me
thank you.
 
i think i found it .

print DATEADD(minute,-151,'18:30')
is it right?
 
It looks right to me. Just be careful about changing days. For example, if endtime = '1:30' (AM) and duration is 300 minutes, your start time would be 5 hours earlier, so, '8:30' (pm) of the previous day. This may not ever cause you problems (depending on your data), but it is something you should probably think about.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top