Reputation: 4997
I am using following code to calculate time difference. I want to display it in seconds, not in HH:MM:SS Please advise.
Dim myTime = DateTime.Parse("15:40:00 PM")
Dim vrNowTime = DateTime.Parse(TimeOfDay)
Dim result = vrNowTime - myTime
Label1.Text = vrNowTime & " " & myTime
MsgBox(result.ToString)
Thanks
Upvotes: 4
Views: 17587
Reputation: 7244
You can also use
Dim Result = DateDiff(DateInterval.Second,Time1,Time2)
Upvotes: 5
Reputation: 7471
Use result.TotalSeconds
(and round it if you want an integer number to be displayed).
Also you may want to write simply:
Dim result as TimeSpan = Now() - myTime
Upvotes: 11