Time Addition

Discussion in 'Questions (Windows Mobile)' started by busboy, Oct 1, 2007.

  1. busboy

    busboy New Member

    Is it possible to add or subtract large time values in basic4ppc.
    For example 32:10 + 40:10 = 72:20
    If it is possible how do you go about doing it? If not what other alternate do I have beside converting it to fractions?

  2. Erel

    Erel Administrator Staff Member Licensed User

  3. busboy

    busboy New Member

    Yes. In fact, would it be possible to add 140:34 i.e140mins and 34 sec, to say 12:10 to get 152:44.

    I have read the tutorial some time back but have still not figured a way to do this!

    Thanks for your quick reply
  4. Erel

    Erel Administrator Staff Member Licensed User

    You will need to parse the strings:
    Sub App_Start
    End Sub

    Sub MSAdd(x,y)
        i = StrIndexOf(x,
    If i = -1 Then Return "00:00"
        m1 = SubString(x,
        s1 = SubString(x,i+
        i = StrIndexOf(y,
    If i = -1 Then Return "00:00"
        m2 = SubString(y,
        s2 = SubString(y,i+
        s = s1 + s2
        m = m1 + m2 + Int(s/
    Return m & ":" & Format((s Mod 60),"D2")
    End Sub
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice