hi guys i need to reduce an amount of time by x% this is what i have so far
as u can see ive taken the hours minutes seconds from the time and stored each in a seperate variable so from 02:30:00 i then divided the hours by 60 and then 60 again to give me the total seconds in the hours and then divided the minutes by 60. i then added all 3 to give the total amount of seconds so now the buildtimetotal variable now holds the total in seconds i now need to reducce this by x% all vars are dimentioned as integers except for buildtimehoursback which is a double the problem seems to be when i try to convert the total seconds back to hours minutes seconds.
any help appreciated
VB.NET:
Public Sub timeconverter()
'---------------------place hours minutes and seconds into variable-------------------------
buildtimehours = Mid$(irontime.Text, 1, 2)
buildtimeminutes = Mid$(irontime.Text, 4, 2)
buildtimeseconds = Mid$(irontime.Text, 7, 2)
'-------------------------------------------------------------------------------------------
'-----------------------------break hours down into seconds---------------------------------
buildtimehours = buildtimehours * 60 * 60
buildtimeminutes = buildtimeminutes * 60
buildtimetotal = buildtimehours + buildtimeminutes + buildtimeseconds
'-------------------------------------------------------------------------------------------
'---------------------------get construction level percent bonus----------------------------
buildtimeconstructionlvl = constructionlvla.Value * 10
buildtimebonus = buildtimetotal / 100
buildtimepercent = buildtimebonus * buildtimeconstructionlvl
buildtimetotal = buildtimetotal - buildtimepercent
'-------------------------------------------------------------------------------------------
'------------------convert the total back into hours minutes and seconds--------------------
buildtimehoursback = buildtimetotal / 60
buildtimehoursback = buildtimehoursback / 60
buildtimehours = Mid$(buildtimehoursback, 1, 2)
'-------------------------------------------------------------------------------------------
End Sub
as u can see ive taken the hours minutes seconds from the time and stored each in a seperate variable so from 02:30:00 i then divided the hours by 60 and then 60 again to give me the total seconds in the hours and then divided the minutes by 60. i then added all 3 to give the total amount of seconds so now the buildtimetotal variable now holds the total in seconds i now need to reducce this by x% all vars are dimentioned as integers except for buildtimehoursback which is a double the problem seems to be when i try to convert the total seconds back to hours minutes seconds.
any help appreciated