locked
converting time to seconds RRS feed

  • Question

  • i was wondering how you would convert a time to seconds

    i want to convert something like 6:40 when input into a textbox and have 400 seconds outputed


    Monday, December 1, 2008 11:59 PM

Answers

All replies

  • Use the System.TimeSpan structure.  Create a new one with the appropriate constructor (in the case of your example above,

    new TimeSpan(0, 6, 40),

    then extract the total seconds using the TotalSeconds property.

    Complete information in the MSDN documentation.

    Wayne
    • Proposed as answer by WayneC Tuesday, December 2, 2008 2:20 AM
    Tuesday, December 2, 2008 2:18 AM
  • Hi delmonxc,

    Thanks for your post.

    However, this forum is for Interoperability purposes.

    Assuming you are using C#, I would suggest that you post your question in a more appropriate forum as:

    Visual C# General

    http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/threads/

    Thanks,

    SEBASTIAN CANEVARI - MSFT Senior SEE Protocol Documentation Team
    Tuesday, December 2, 2008 10:36 PM
    Moderator