计算类似格式的"2008-8-4 0:00:34" 和 "2008-8-4 0:14:54" 的时间差 具体怎么写 先顶之 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 只要可以运行 立即揭贴 期待ING class Program { static void Main(string[] args) { string myDateTimeValue1 = "4/8/2008 0:00:34"; string myDateTimeValue2 = "4/8/2008 0:14:54"; DateTime time1 = DateTime.Parse(myDateTimeValue1); DateTime time2 = DateTime.Parse(myDateTimeValue2); TimeSpan time3 = time2 - time1; Console.Write("{0}",time3.ToString()); Console.ReadLine(); } } 如果要是算 不在一天里的时间差 你那么写肯定有毛病 不过根据你的思路 我确实 把扣 解了 谢谢 马上给分另附上代码做参详 string myDateTimeValue1 = "2008-8-3 0:00:34"; string myDateTimeValue2 = "2008-8-4 0:20:34"; DateTime time1 = DateTime.Parse(myDateTimeValue1); DateTime time2 = DateTime.Parse(myDateTimeValue2); TimeSpan time3 = time2 - time1; Response.Write(time3.TotalMinutes.ToString()); 晕了,没仔细看,代码没错,我刚才把myDateTimeValue1 = "4/8/2008 0:00:34"里面的的3写成4了, 加个QQ好友啊,一起交流,CSDN老早就注册了,一直潜水!:) 线程Thread调用时System.Web.HttpContext.Current为NULL的问题 treeview控件的一个小问题 验正纯文本文件 一段程序有点不明白~ 如何用c#实现红外的通信??非(win ce) DataTable.Copy() 的一个奇怪问题,请大家帮看看。100fen 如何增加XML节点的一个属性,请指点!!!!!!!!! 用p3,256的机器能运行.net和c3吗? 请问怎样获取一个menuitem的name? 能帮我解释一下C#中的代表(delegate)是什么意思??? 在自己写的函数中调用控件的方法. 问一个mysql查询的问题
class Program
{
static void Main(string[] args)
{
string myDateTimeValue1 = "4/8/2008 0:00:34";
string myDateTimeValue2 = "4/8/2008 0:14:54";
DateTime time1 = DateTime.Parse(myDateTimeValue1);
DateTime time2 = DateTime.Parse(myDateTimeValue2);
TimeSpan time3 = time2 - time1;
Console.Write("{0}",time3.ToString());
Console.ReadLine();
}
}
string myDateTimeValue2 = "2008-8-4 0:20:34";
DateTime time1 = DateTime.Parse(myDateTimeValue1);
DateTime time2 = DateTime.Parse(myDateTimeValue2);
TimeSpan time3 = time2 - time1;
Response.Write(time3.TotalMinutes.ToString());