I iknowyou Active member Joined Jun 14, 2011 Messages 37 Programming Experience 1-3 Jun 23, 2011 #1 How can I get the difference of this two Date time. (6/21/2011 7:02:53 AM) subtract by (6/21/2011 4:00:00 AM) the answer should be ---> 03:02:53 Please Help...
How can I get the difference of this two Date time. (6/21/2011 7:02:53 AM) subtract by (6/21/2011 4:00:00 AM) the answer should be ---> 03:02:53 Please Help...
I iknowyou Active member Joined Jun 14, 2011 Messages 37 Programming Experience 1-3 Jun 23, 2011 #2 Got it now. Here is the code. Dim fDate As DateTime = "6/21/2011 7:02:53 AM" Dim secondDate As DateTime = "6/21/2011 4:00:00 AM" Dim totalTime As TimeSpan = fDate.Subtract(secondDate) Console.WriteLine(totalTime.ToString()) Upvote 0 Downvote
Got it now. Here is the code. Dim fDate As DateTime = "6/21/2011 7:02:53 AM" Dim secondDate As DateTime = "6/21/2011 4:00:00 AM" Dim totalTime As TimeSpan = fDate.Subtract(secondDate) Console.WriteLine(totalTime.ToString())
JohnH VB.NET Forum Moderator Staff member Joined Dec 17, 2005 Messages 15,858 Location Norway Programming Experience 10+ Jun 23, 2011 #3 or using ordinary subtraction operator: Dim difference = fDate - secondDate Upvote 0 Downvote