比如 textbox1.text=2007/7/4 12;12;10  textbox2.text=2007/7/4  15:12:10
我想在另一個textbox3.text=textbox1.text-textbox2.text得多少秒?

解决方案 »

  1.   

    TimeSpan.FromSeconds 方法 
    返回表示指定秒数的 TimeSpan
    具体怎么使用察看MSDN library
      

  2.   

    TimeSpan ts = new TimeSpan();
    ts = DateTime.Parse(Textbox2.text) - DateTime.Parse( Textbox1.text ) ;int i = ts.Seconds ;//此为相差秒数
      

  3.   

    楼上的不需要new TimeSpan()
    TimeSpan ts = DateTime.Parse(Textbox2.text) - DateTime.Parse( Textbox1.text ) ;
      

  4.   

    按你那个应该把ts的天数* 24*3600 + ts的小时*3600 + ts的分钟数*60 + ts的秒数
    才是你要的结果