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!

Convert Time into Minutes 3

Status
Not open for further replies.

ecugrad

MIS
Apr 17, 2001
191
US
Need a little help. I need to convert a time string into minutes
Example 144:58:12 would equal 8698 minutes. I'm really not worried about the seconds.

Any help to get me started would be appreciated.

Mike
 
Code:
value = "144:58:12"
arrTime = Split(Value, ":")
minutes = arrTime(0) * 60 + arrTime(1)
 
Off the top of my head.

Code:
<%
function ToMinutes(strIn)
dim times 
Times = split(strIn,":")
ToMinutes = (Cint(Times(0) * 60)) + Cint(Times(1))
end function
%>


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
You can use the split function on the ":" then multiply the first element of the array * 60 and add the second element.

Code:
dim thisTime, timeArray, totalMins

thisTime = "144:58:12"
thisTimeArray = Split(thisTime, ":")
totalMins = (thisTimeArray(0) * 60) + thisTimeArray(1)

Response.Write(totalMins)
Response.End

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top