-3
两个时间之间的区别
textboxSart > textboxEnd
textboxEnd - textboxStart的伎俩,但如果一开始是15:00和结束是2:00我试图找到两个文本框
我想到的该解决方案
24 - textboxStart + textboxEnd
我不得不减去23点59分,然后添加一个一分钟,因为没有24小时
textboxResult.text = (Convert.ToDateTime("23:59") - Convert.ToDateTime(textBoxStart.Text).AddMinutes(-1)).ToString();
但我不能在textboxEnd
Convert.ToDateTime(textBoxStart.Text).AddMinutes(-1).AddHours(textboxEnd.tex)).ToString(); //i tried this, and i did convert to double but it didn't work
你可以将它们转换成[时间跨度(HTTPS:/ /msdn.microsoft.com/en-us/library/system.timespan(v=vs.110).aspx),然后减去它们。 – Jalal
谢谢你的工作 –
这很好。您现在可以发布您的解决方案,并将其标记为答案,以便任何人都可以使用它:) – Jalal