easiest way to sum time - is there one ?

easiest way to sum time - is there one ?

  
Hi All,
   I am trying to sum some time and I am getting problems. I tried use DiffHours but it is imprecise (see picture attached). The same occurred to DateTime_PrettyFormat() function. I attached an example of what I want and would like to know if someone know how to solve this problem using simple "style/functions" as excel.

Thanks for any feedback
I created a very simple page with two 'date time' variables and then used an expression with DiffHours(Var1, Var2) and it worked exactly as expected.

1/1/2014 01:00:00  1/1/2014 01:20:00 showed 0 hours
1/1/2014 01:00:00  1/1/2014 00:00:00 showed -1 hours
1/1/2014 01:00:00  1/2/2014 02:00:00 showed 25 hours

What's interesting is that the pretty format in your example does correctly show 20 minutes.  It's hard to tell whether you are trying to compute hours, minutes or something else but based on my little experiment I believe the functions work.  The only issue that I'm aware of that could be causing you a problem is time zone.  If you enter a time, say 1:47:00 local time as in your example but you live 1 hour away from Portugal time, the time that the personal edition uses because that's where it is hosted, and compare that to CurrTime() you could get the result you are seeing.  I'm aware of this because I have to compensate for a five hour difference being in the US.

Hope this helps.


Very interesting,
   do you know how to inform the gmt+3 or my current location ?  Compensate time will not work because we have daylight saving.
Unfortunately, there is no automatic way of handling time zone within the platform.  There is a component in Forge called Time Zone (http://www.outsystems.com/forge/component/500/time-zone/) that should be able to help you manage the issue.  What I've been doing is storing everything as UTC (which happens to be the same as Portugal time) and doing the correct math using the AddHours function whenever I have an input or output that is user visible.  Even though this is probably a little more work it will always work even if you were to host your application somewhere else eventually.

Note that the time zone issue is documented in the help for the DiffHours function as well as other places.