Dear Roberto,
I don't know whether you are using the date and hours format or just the time format like what you just gave here, though your variable name is enddate or initialdate.
Anyway. you can just use a simple function like "EndDate" - (minus sign) "InitialDate.
It should be able to give you an answer. Note that all your date or time fields (inital and end) should be in the same format, e.g. MM/DD/YYYY, hh:mm. If you are having problems, Check first of your fields have the same format!
Just try and see!
Dr Mathe
Hi Gabriel,
Subtracting one date/time from another works but result is number of days in decimal format.
Epi Info 3 has HOURS function that is supposed to return the number of hours between two times (see Help under "Functions and Operations")
The result, however may not always be what you expect. For example, if the duration is 3 hours and 1 minute, HOURS function will return "4". That is, any portion of an hour is considered a full hour.
If you want to calculate hours or minutes with more precision, or have rounded hours or minutes,
here are some formulae to use (note: 3600 is 60*60 and 1440 is 24*60)
-------------
Instead of: HOURS(InititalTime, EndTime)
(EndTime - InitialTime) * 24
or
SECONDS(InititalTime, EndTime) / 3600
Rounded hours:
ROUND((EndTime - InitialTime) * 24)
or
ROUND(SECONDS(InititalTime, EndTime) / 3600)
--------------
Instead of: MINUTES(InititalTime, EndTime)
(EndTime - InitialTime) * 1440
or
SECONDS(InititalTime, EndTime) / 60
Rounded minutes:
ROUND((EndTime - InitialTime) * 1440)
or
ROUND(SECONDS(InititalTime, EndTime) / 60)
Attached is an Epi Info 3 mdb file with comparison results.
Hope this helps,
Roy Ing
http://www.EpiSuccess.com
Roy
This was exactly what I was looking for.
Tks VM
© 2014 Created by phConnect Admin.