Convert Time into Elapsed Time

Posted on 2006-04-19
Last Modified: 2010-04-16
How do you convert an actual time into elapsed Time

I.e. this


into this

Question by:phunchak
    1 Comment
    LVL 85

    Accepted Solution

    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);

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    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…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now