[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Convert Time into Elapsed Time

Posted on 2006-04-19
2
Medium Priority
?
177 Views
Last Modified: 2010-04-16
How do you convert an actual time into elapsed Time

I.e. this

22:30:08
22:30:28
22:30:48
22:31:08

into this
0.08
0.28
0.48
1.08



0
Comment
Question by:phunchak
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 600 total points
ID: 16493518
So 22:30:00 is the start time?

Use two DateTime() instances and then use their Subtract() method to get a TimeSpan() instance which is what you want.

Something like...

    DateTime startDT = DateTime.Now;

    // do some stuff...

    DateTime stopDT = DateTime.Now;

    TimeSpan ts = stopDt.Subtract(startDt);
    MessageBox.Show(ts.TotalMinutes.ToString());
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question