Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have two date and timming and i want to calculate total hours from this two date and timings.please help me example:
2014-08-14 16:10:03 and 2014-08-14 16:24:28
Posted
Updated 15-Sep-14 18:27pm
v2
Comments
[no name] 16-Sep-14 0:26am    
what u mean? question is not clear...!
Member 9027346 16-Sep-14 0:28am    
i want to calculate total hours.

1 solution

use TimeSpan

VB
Dim convertedDate1 As Date = Date.Parse("2014-08-14 16:10:03 ")
Dim convertedDate2 As Date = Date.Parse("2014-08-14 16:24:28")

    Dim timePeriod As TimeSpan
    timePeriod = convertedDate2.TimeOfDay - convertedDate1.TimeOfDay


see the example created in dotnetfiddle

https://dotnetfiddle.net/iUc8qx[^]
 
Share this answer
 
v2
Comments
Gihan Liyanage 16-Sep-14 4:46am    
Did you solved your quarry ?
Member 9027346 16-Sep-14 5:53am    
yes,using timediff function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900