【发布时间】:2012-10-04 16:22:24
【问题描述】:
我正在使用TimeSpan.ParseExact 方法来解析时间跨度。但是,为什么下面会失败并抛出异常呢?
string time = "23:10:00";
string format = "HH:mm:ss";
TimeSpan timeSpan = TimeSpan.ParseExact(time, format, CultureInfo.InvariantCulture);
从MSDN上Custom Date and Time Format Strings的文章来看,这个输入字符串的格式是正确的。有什么想法吗?
【问题讨论】:
-
这看起来不像 C++。应该标记为 C# 还是 CLI?