我在表“PostThr”中有一个TimeSpan列“ThrEndT”要填充。我想在“12:30”中引用一个用户12:30PM。长话短说,TimeSpan是比DateTime更好的选择。(我想)
postThr.ThrEndT = postThr.ThrTime + TimeSpan.Parse("12:30");
它吐出“21:30”。。。我检查了3次,并阅读了文档( https://learn.microsoft.com/en-us/dotnet/api/system.timespan.parse?view=net-6.0 )3次。我也试过“12:30:00”,但没有成功。
我不知道自己做错了什么,也不知道该如何解决。任何想法都将不胜感激。谢谢
在我看来,你的代码正在做你想做的事情 9:00 到 ThrTime ,然后将该值添加到 12:30 并将其分配给 ThrEndT ,从而得到 21:30 。我觉得这是对的。
9:00
ThrTime
12:30
ThrEndT
21:30