Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Time Addition

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-01-2007, 01:03 PM
Newbie
 
Join Date: Oct 2007
Posts: 2
Default Time Addition

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?

Thanks
Reply With Quote
  #2 (permalink)  
Old 10-01-2007, 01:13 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I recommend you to read the Date & Time tutorial: http://www.basic4ppc.com/forum/tutorials/894-date-time.html

Does 32:10 mean 32 minutes and 10 seconds?
Reply With Quote
  #3 (permalink)  
Old 10-01-2007, 01:30 PM
Newbie
 
Join Date: Oct 2007
Posts: 2
Default

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
Reply With Quote
  #4 (permalink)  
Old 10-01-2007, 01:41 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You will need to parse the strings:
Code:
Sub App_Start
    
Msgbox(MSAdd("123:33","40:35"))
End Sub

Sub MSAdd(x,y)
    i = StrIndexOf(x,
":",0)
    
If i = -1 Then Return "00:00"
    m1 = SubString(x,
0,i)
    s1 = SubString(x,i+
1,StrLength(x)-i-1)
    i = StrIndexOf(y,
":",0)
    
If i = -1 Then Return "00:00"
    m2 = SubString(y,
0,i)
    s2 = SubString(y,i+
1,StrLength(y)-i-1)
    s = s1 + s2
    m = m1 + m2 + 
Int(s/60)
    
Return m & ":" & Format((s Mod 60),"D2")
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date and Time Erel Tutorials 6 01-28-2010 11:01 PM
Mars Time alfcen Share Your Creations 4 05-12-2008 11:21 AM
Time question Cableguy Questions (Windows Mobile) 2 01-05-2008 10:49 AM
Add & Subtract Time cdeane Questions (Windows Mobile) 11 11-28-2007 08:24 AM
Load time BPak Questions (Windows Mobile) 3 08-28-2007 03:27 AM


All times are GMT. The time now is 05:21 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0