none
TimeSpan.Parse(string) not parsing 24 hours RRS feed

  • Question

  • TimeSpan.Parse("24:00:00") returns a TimeSpan of 24 days...

    this doesn't make sense since TimeSpan.Parse("23:59:59") return 23.9 hours...

    Friday, February 18, 2011 9:32 PM

Answers

  • Hours must be from 0-23 for it to consider the string format as hh:mm:ss.  If the first value >= 24, then Parse assumes the string value represents dd:hh:mm.

    HTH,
    ShaneB

    • Marked as answer by eryang Wednesday, March 2, 2011 2:52 AM
    Friday, February 18, 2011 10:35 PM

All replies

  • Hours must be from 0-23 for it to consider the string format as hh:mm:ss.  If the first value >= 24, then Parse assumes the string value represents dd:hh:mm.

    HTH,
    ShaneB

    • Marked as answer by eryang Wednesday, March 2, 2011 2:52 AM
    Friday, February 18, 2011 10:35 PM
  •  

    We temporarily mark a reply since the thread idle for a long time, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 2, 2011 2:52 AM