2008-10-16 82 views

回答

10
DateTime dt1 = DateTime.Now; 
DateTime dt2 = DateTime.Now.AddDays(1); 

int diff = dt2.Subtract(dt1).TotalMinutes; 
6

看時間跨度類。

 DateTime date1 = DateTime.Now; 
     DateTime date2 = DateTime.Now.AddDays(1); 

     TimeSpan diff = date2.Subtract(date1); 
     Console.WriteLine(diff.Minutes); 
+0

怪客downvoting是有趣的。 – FlySwat 2008-10-16 23:26:01

+0

如果不是你的代表,我會說「歡迎來到SO!」 ;) – rcreswick 2008-10-16 23:29:21

-2
DateTime currentTime = DateTime.Now; 
DateTime tommorowTime = currentTime.AddDays(1); 
TimeSpan diffTime = tommorowTime - currentTime ; 
Console.WriteLine(diffTime.TotalMinutes);