getting seconds passed since ....

Posted on 2006-04-27
Last Modified: 2010-04-16

How do I get the number of seconds passed since a certain date (say since 01-01-2006)?
Question by:EnolaKotrotsos
    LVL 11

    Accepted Solution

    i think you should do something like:

    DateTime dateStart, dateEnd;

    TimeSpan ts = dateEnd - dateStart;
    Console.Write( "{0}", ts.Secconds );
    LVL 4

    Expert Comment

    almost correct, but you should use TotalSeconds

    DateTime SomeDate = Whatever date you need;

    TimeSpan ts = DateTime.Now - SomeDate;
    Console.Write( "{0}", ts.TotalSecconds );
    LVL 1

    Author Comment

    Hey thanks people!.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 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