how to Calculate Time

  • Thread starter Thread starter yoshitha
  • Start date Start date
Y

yoshitha

hi ,
am developing quiz application.

the questions will be displayed one at a time after clicking next button
only the next question will be displayed.

for evry test the time to finish this test will be maintained in back end.

so i set 75 minutes for a particulat test. after 75 minutes whether the

candidates completed all the question or not but the test must be closed.

can anybody tell me how to do this one.

thanx in advance
yoshitha
 
Hi, Yoshitha!

Have a look at the System.TimeSpan struct.

It's returned by the mathematical operators for DateTime types.

Example:
// This might be a static member in your application class, or a member of
the "Test" class if you have one..
DateTime testStart = DateTime.Now;

// Do your stuff

// Check if 75 min has passed:
TimeSpan timeUsed = DateTime.Now - testStart;
if (timeUsed.TotalMinutes > 75)
{
// Stop test
}


HTH,
Lars-Erik
 
Simply you can use javascript settimeout method to post
page back...
 
Is it a web based application or a windows based
application?
I think it is a web based application because it is posted
aspnet section
 
I think you're right. :)

Anyway - there's loads of possible ways to persist DateTime variables across
pages, but that's another issue. :)
(I.E. put the result of one of the string conversion methods in a cookie)

Lars-Erik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top