display time remaining on the form (1 Viewer)

obeylele

Registered User.
Local time
Today, 13:29
Joined
Jul 29, 2005
Messages
28
i want to display time remainig on my quiz form
say quiz has a total time of 15 mins
so i want to show the time on my form
so the user know how much time he/she got

i did search th eforums but couldnt find any
sorry if it is here already
if it is can some on epint it for me
thanks in advance
 

FoFa

Registered User.
Local time
Today, 04:29
Joined
Jan 29, 2003
Messages
3,672
I would think something along the lines of, when the start time is established, calculate the finish time. Store the finish time in a global variable. Have a timer control on the form that refreshes say every 5 seconds, and calculates the difference between the current time and the finish time (global variable) and refreshes the value.
Just mu thoughts.
 

obeylele

Registered User.
Local time
Today, 13:29
Joined
Jul 29, 2005
Messages
28
yes this is what ihad in mind
but unfortunately i am ahving hard time calculating
with itmes
first Time function doesnt see to work
if you could show me synatx

hr = Hour(Time)
min = Minute(Time)
sec = Second(Time)
startTime = Time + 15 ' add 15 minutes

this is what i am doing no luck so far
MsgBox "Time: " & hr & ":" & min & ":" & sec

THIS IS COMING AS tIME 0:0:0
 

FoFa

Registered User.
Local time
Today, 04:29
Joined
Jan 29, 2003
Messages
3,672
Have you looked at the DATEDIFF function?
 

obeylele

Registered User.
Local time
Today, 13:29
Joined
Jul 29, 2005
Messages
28
thanks to ghudson the problem is solved

but i settled for showing time starting from 0:00 to the time i want the quiz to end by using datediff of start time and now()

not as a count down as i was trying before. And i think in this case it is better tho show time this way.

But i would like to know how i can add say 30 minutes to the
time i get from now() function, should i get the hour minute second
seperately from the date and do my calculations or is there an easy way,
 

Bat17

Registered User.
Local time
Today, 10:29
Joined
Sep 24, 2004
Messages
1,687
Time is a fractional part of a day, so a minute is (1/24/60)
startTime = Time + (15/24/60)' add 15 minutes

HTH

Peter
 

bomberchia

Silenced
Local time
Today, 17:29
Joined
Sep 26, 2005
Messages
17
Bat17 said:
Time is a fractional part of a day, so a minute is (1/24/60)
startTime = Time + (15/24/60)' add 15 minutes

HTH

Peter

so how do i add this function into the code?
 

Users who are viewing this thread

Top Bottom