两个数字如何相减,A=46:33 ,B=15:56
A,B都表示时间长度,现在如何得到AB之间的差值
A,B都表示时间长度,现在如何得到AB之间的差值
解决方案 »
- datagridview选中单元个更改背景颜色
- TreeView.Nodes.Add()方法的用法?
- 高分100, 解决Timeout expired?????????????
- 请问如何控制 MDI父窗体 始终都不显示滚动条?
- 特殊舉表達式難題,有碰到過的朋友沒,急!
- WebClient类的DownloadFile方法对于某些图片无法下载,什么原因?
- C#我的System.web命名空间里为什么没有HttpUtility类?
- 使用OleDbDataAdapter把从vb传到.net的RecordSet装载到一个DataTable,遇到奇怪的问题,请教高手,谢谢!急!
- 请教httphandler伪静态问题
- wmf转pdf有什么好方法
- ListView怎么取值
- TeeChart如何标记某点的值
TimeSpan intervalVal2 = TimeSpan.Parse( "15:56" );
TimeSpan res = intervalVal2 - intervalVal1;Console.WriteLine(res.ToString());
DateTime d1 = DateTime.ParseExact("46:33","mm:ss",null);
DateTime d2 = DateTime.ParseExact("15:56", "mm:ss", null); Console.WriteLine(d2 - d1);
就有差值了...
DateTime d2 = DateTime.Parse("15:56");
TimeSpan ts=dt1-dt2;
DateTime d1 = DateTime.Parse("46:33",);
DateTime d2 = DateTime.Parse("15:56");
TimeSpan ts=dt1-dt2;改正后,运行:
Unhandled Exception: System.FormatException: The DateTime represented by the string is not supported
in calendar System.Globalization.GregorianCalendar.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s)
at Test.Program.Main(String[] args) in E:\.Net Projects\Test\Test\Program.cs:line 956
所以 DateTime d1 = DateTime.Parse("46:33"); 运行会异常