time in qb
OK, i have the loop now and it looks something like this
but it has some issues...
1. When it gets to single digits in seconds remaining 4:09 for isntance. how do I get it to display "4:09" instead of "4: 9"? i've tried some simple work arounds that have failed..any ideas?
2. When it gets past 4 minutes even, the minutes change to 3, but the seonds go down past 0, instead of going back to 59. i get 3:-1, etc. how do i fix this, once again i've tried some simple stuff but its failed
other then that its been good though...
Code: Select all
t! = timer +1
timerem = timestart
'timestart is 300 in this case 5 minutes, set in another spot
DO
If timer = T! then
t! = timer +1
timerem = timerem -1
minuterem = timerem/60
secrem = int(timestart-(minuterem*60)
print fix(minuterem);
print ":";
print 60- secrem
end if
loop
1. When it gets to single digits in seconds remaining 4:09 for isntance. how do I get it to display "4:09" instead of "4: 9"? i've tried some simple work arounds that have failed..any ideas?
2. When it gets past 4 minutes even, the minutes change to 3, but the seonds go down past 0, instead of going back to 59. i get 3:-1, etc. how do i fix this, once again i've tried some simple stuff but its failed
other then that its been good though...
In order to show "xx:xx" you'll need to add some stuff:
I hope this works for ya!
grtz
Seb
Code: Select all
if len(ltrim$(rtrim$(str$(secrem)))) < 2 then
print "0"+ltrim$(rtrim$(str$(secrem)))
else
print secrem
end if
grtz
Seb
lostoros,
Your conversion of seconds to MM:SS is not working. I'm going to insert into your code part of the conversion logic which I previously posted.
This should solve all your "issues".
*****
Your conversion of seconds to MM:SS is not working. I'm going to insert into your code part of the conversion logic which I previously posted.
Code: Select all
t! = timer +1
timerem = timestart
'timestart is 300 in this case 5 minutes, set in another spot
'***NOTE: The following will only work if minutes is less than 60,
' that is, if timestart is less than 3600.
DO
If timer = T! then
t! = timer +1
timerem = timerem -1
rem ... minuterem = timerem/60
rem ...secrem = int(timestart-(minuterem*60)
ISEC=timerem
IF ISEC >= 60 THEN
MM = INT(ISEC/60)
ISEC=ISEC-MM*60
ELSE
MM = 0
END IF
SS = ISEC
print right$("00"+ltrim$(str$(MM)),2);":";
print right$("00"+ltrim$(str$(SS)),2)
end if
loop
*****