TimeSpan.Parse time format hhmmss

后端 未结 6 1513
忘掉有多难
忘掉有多难 2020-12-15 20:52

in c# i have time in format hhmmss like 124510 for 12:45:10 and i need to know the the TotalSeconds. i used the TimeSpan.Parse(\"12:45:10\").ToTalSeconds but it does\'nt tak

6条回答
  •  感动是毒
    2020-12-15 21:29

    You need to escape the colons (or other separators), for what reason it can't handle them, I don't know. See Custom TimeSpan Format Strings on MSDN, and the accepted answer, from Jon, to Why does TimeSpan.ParseExact not work.

提交回复
热议问题