Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10... 9... 8... 7... 6... 5... 1... Countdown
#1
I was trying to make a program use the DAE$ and TIME$ funtions to countdown the days / min / hours left till a certain time

Code:
CLS
DO
LOCATE 1, 1
PRINT DATE$, " current date"

t = VAL(LEFT$(TIME$, 2))
IF t > 12 THEN t = t - 12: ampm$ = " PM" ELSE ampm$ = " AM"
tme$ = LTRIM$(STR$(t)) + RIGHT$(TIME$, 6)
PRINT tme$ + ampm$, " current time"

tim$ = ""

FOR i = 1 TO 9 STEP 3
tim$ = tim$ + LTRIM$(STR$(VAL(MID$("23:59:59", i, 2)) - VAL(MID$(TIME$, i, 2)))) + ":"
NEXT i
IF MID$(tim$, LEN(tim$), 1) = ":" THEN MID$(tim$, LEN(tim$), 1) = " "
tim$ = RTRIM$(tim$)
PRINT tim$, " until midnight";
LOOP UNTIL LEN(INKEY$)
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
And?
Antoni
Reply
#3
I need help? Plz?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#4
You could convert target time-date to seconds, and store it in a LONG . Then, at intervals you convert present time-date to seconds. You have in this way both values in the same units so you can substract them and display the result.
Antoni
Reply
#5
what? im still confused
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
he's saying convert the day and time and all that into seconds. like a julian day number. with seconds.

of course, my suggestion would be to just calculate the julian day number, and the seconds offset. there's a number of javascript routines on the 'net, and they're easy to cross over.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)