Johnny
asked on
how do i find time diffrence
im trying to find time diffrence between two times... in hours,mins,sec
example
10/24/2004 12:12:47 AM
10/24/2004 12:12:49 AM
in this case its 0 hours, 0 mins, and 2 seconds
the format for the date - time string will stay the same... in each case...
thx
Johnny
aka Pern
example
10/24/2004 12:12:47 AM
10/24/2004 12:12:49 AM
in this case its 0 hours, 0 mins, and 2 seconds
the format for the date - time string will stay the same... in each case...
thx
Johnny
aka Pern
Date.Subtract returns a TimeSpan object, from which you can get the total days, seconds, minutes, etc.
Msgbox(Date.Subtract(Now, MyDate).TotalSeconds.ToStr ing)
KGREG
Msgbox(Date.Subtract(Now, MyDate).TotalSeconds.ToStr
KGREG
Hi,
Dim a as Date = #10/24/2004 12:12:47 AM#
Dim b as Date = #10/24/2004 12:12:49 AM#
Dim diff As TimeSpan = b.Subtract(a)
Then you can access to all the TimeSpan properties : for example diff.Seconds() to have the number of second elapsed between a and b.
Glom
Dim a as Date = #10/24/2004 12:12:47 AM#
Dim b as Date = #10/24/2004 12:12:49 AM#
Dim diff As TimeSpan = b.Subtract(a)
Then you can access to all the TimeSpan properties : for example diff.Seconds() to have the number of second elapsed between a and b.
Glom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect thx
https://www.experts-exchange.com/questions/21069414/vb-net-comparing-dates.html