|
-
Jun 10th, 2007, 04:11 AM
#1
Thread Starter
Lively Member
[2005] how to find different between to times
hi friends
i need to get the diff between two dates and including the time diff also.
there is a fun datediff from that i got date diff and
how to the time diff?
thanks in advance
with regards
ravi
-
Jun 10th, 2007, 06:21 AM
#2
Re: [2005] how to find different between to times
Use Timespan, you can ask it to output days, minutes, hours, seconds etc...
Just give it the two dates, then subtract them:
2 Code:
Dim Tspan As TimeSpan
Dim date1 As Date = Date.Now
Dim date2 As Date = Date.ParseExact("10/06/2007 08:23:14", "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
Tspan = date1 - date2
MessageBox.Show("Total Hours: " & Tspan.Hours.ToString & " Total Minutes: " & Tspan.Minutes.ToString)
-
Jun 10th, 2007, 12:13 PM
#3
Hyperactive Member
Re: [2005] how to find different between to times
There is also System.DateTime.Subtract
I use this when tracking loading times:
vb.net Code:
Dim start As Date = Now
' Perform function
MessageBox.Show(Me, Now.Subtract(start).TotalMilliSeconds)
That will give me the difference in milliseconds.
Prefix has no suffix, but suffix has a prefix.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|