I'm using the management DateUtils.PeriodBetween to calculate the interval in hours between two dates. Shall not count the hours when you exceed one day, for example:
07/29/2015 - 10:00
30/07/2015 - 11:00
They are calculated 1 hour but not 25 hours
there is a way to properly calculate elapsed time?
thank you
Dim OrigDateFormat As String = DateTime.dateFormat
DateTime.dateFormat = "MM/dd/yyyy HH:mm"
Dim p As Period
p = DateUtils.PeriodBetween(DateTime.DateParse("07/29/2015 10:00"),DateTime.DateParse("07/30/2015 11:00"))
Log(p.Days & " day(s) " & p.Hours & " hr(s)") 'displays 1 day 1 hr
DateTime.dateFormat =OrigDateFormat
Thank you for the answers, but probably will not make myself clear.
I need to calculate the number of hours that there are two periods of dates (with days apart) and I thought that the function PeriodBetween was able to do this calculation ElapsedTime
even after this post i for myself i´m not sure to understand what exactly you want to do
@Mahares showed you the right way to calculate the period between two dates.
Maybe you should describe it more clearly what exactly is the base, what exactly do you want to archieve and what is the code you are trying to get this result but did not work
start time and date = 07.01.2015 10:00
end date and time = 07/25/2015 06:00
how many hours?
I thought that had already PeriodBetween function that returns the "sum of hours." While, returns the number of days and number of hours "part. In this case the hours are calculated -4.
I repeat, I thought there was the function elapsedtime.