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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Total Time

Status
Not open for further replies.

richrich05

Programmer
Aug 15, 2005
24
US
I'm trying to to calculate two datetime fields into total minutes and hours. Anyone know a way to do this function?

Something like (Starttime)(Endtime) = Totaltime
 
Are you trying to get the difference in time? Like this...

Code:
declare @Start DateTime
Declare @End DateTime

Set @Start = '6/10/2007 8:15 AM'
Set @End = '6/10/2007 10:55 AM'

Select @End - @Start

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
if you use the datediff function, you can tell it to return the result in whatever time units you want...

--------------------
Procrastinate Now!
 
actually i do have some dates in my table as 1/1/1900 i figured i would use a else statment and show the column as a blank row.
 
Well I'm trying to convert a date field called endtime from '6/10/2007 8:15 AM' and the starttime field into some kind of total of hours and minutes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top