DateTime dt1 = Convert.ToDateTime("2010-10-1 10:01:30"); DateTime dt2 = Convert.ToDateTime("2010-10-2 10:02:40"); TimeSpan ts = dt2.Subtract(dt1); Console.WriteLine(ts.TotalSeconds);
2022-07-11 12:59:34
DateTime dt1 = Convert.ToDateTime("2010-10-1 10:01:30"); DateTime dt2 = Convert.ToDateTime("2010-10-2 10:02:40"); TimeSpan ts = dt2.Subtract(dt1); Console.WriteLine(ts.TotalSeconds);