locked
Working with Date and Time in .net RRS feed

  • Question

  • User-973319413 posted

    Hi All

    I have values which is the hours worked on a project for each day of the week.I would like to add all the values and get the consolidated amount of hours worked each week.

    If i have two values of the format hh:mm:ss like 03:15:00 and 02:20:00.The total should be 05:35:00.Is there any function to add time format as produced above.

    Hope i have raised a question which is understandable

    Ashvin

    Wednesday, April 14, 2010 1:29 PM

Answers

  • User533502567 posted

    If i have two values of the format hh:mm:ss like 03:15:00 and 02:20:00.The total should be 05:35:00.Is there any function to add time format as produced above.
     

    Something like..

    Dim totalTime As New TimeSpan      
    totalTime = TimeSpan.Parse("03:15:00") + TimeSpan.Parse("05:35:00")

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 14, 2010 1:41 PM
  • User188494879 posted

    Like this:

    string t1 = "03:15:00";
            string t2 = "02:20:00";
            TimeSpan ts = TimeSpan.Parse(t1) + TimeSpan.Parse(t2);


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 14, 2010 1:46 PM

All replies

  • User533502567 posted

    If i have two values of the format hh:mm:ss like 03:15:00 and 02:20:00.The total should be 05:35:00.Is there any function to add time format as produced above.
     

    Something like..

    Dim totalTime As New TimeSpan      
    totalTime = TimeSpan.Parse("03:15:00") + TimeSpan.Parse("05:35:00")

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 14, 2010 1:41 PM
  • User188494879 posted

    Like this:

    string t1 = "03:15:00";
            string t2 = "02:20:00";
            TimeSpan ts = TimeSpan.Parse(t1) + TimeSpan.Parse(t2);


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 14, 2010 1:46 PM
  • User188494879 posted

    oops somone posted same before me :) 

    Wednesday, April 14, 2010 1:46 PM