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 time

Status
Not open for further replies.

DougAtAvalon

Programmer
Jan 29, 2001
99
US
I read thru some treads but still can'tome up the answer. i am trying to come up with a calualation of time. i at least am trying to get the difference like the number 5 in this example.

For Example:
Text Box1: 3:50 PM (Medium Time Format)
Text Box1: 3:55 PM(Medium Time Format)
Total Hours:

Then a button to calculate. This is not the code but i can't get nothin to work.
------------------
Sub On click
Dim vStart
Dim vEnd
Dim vTotalMinutes

vTotalMinutes = vEnd - vStart
...etc. to get hours
End Sub
---------------


-Doug

 
DateDiff("n", start, end)

"n" returns the minutes
 
Nancy is ccorrect -up to a point. The function will calculate the minutes, however as soon as the results exceeds one hour the results will not look like a "time" (if it ever did). You should carefully consider who will use the results and in what context, as some formatting may be useful of necessary.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top