Why does TimeSpan.ParseExact not work

前端 未结 5 1025
既然无缘
既然无缘 2020-11-29 10:00

This is a bit wierd. Parsing a text field with a valid timespan fails if I try to be precise!

const string tmp = \"17:23:24\";
//works
var t1 = TimeSpan.Pars         


        
5条回答
  •  攒了一身酷
    2020-11-29 10:21

    Try this:

    var t2 = TimeSpan.ParseExact(tmp, "c", System.Globalization.CultureInfo.InvariantCulture);
    

    Source: Standard TimeSpan Format Strings

提交回复
热议问题