Link to home
Start Free TrialLog in
Avatar of Johnny
JohnnyFlag for United States of America

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

Avatar of dfu23
dfu23

Date.Subtract returns a TimeSpan object, from which you can get the total days, seconds, minutes, etc.

Msgbox(Date.Subtract(Now, MyDate).TotalSeconds.ToString)

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
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johnny

ASKER

Perfect thx