[ 
https://issues.apache.org/jira/browse/OFBIZ-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562780#action_12562780
 ] 

Adrian Crum commented on OFBIZ-715:
-----------------------------------

Jacques,

The first link performs millisecond arithmetic - a definite no-no.

The second link looks more like the code I came up with, but it still falls 
short of giving the exact elapsed time. Instead it gives units elapsed, where 
units can be seconds, minutes, hours, days, etc.

My objective was to create a class that, given two Calendars, can calculate the 
total elapsed time and return the result as years, months, days, hours, 
minutes, seconds, and milliseconds.

This is not an easy problem to solve. I spent several days working on the code 
you see and I finally gave up.


> Utils for doing date calculations based on timeUomIds
> -----------------------------------------------------
>
>                 Key: OFBIZ-715
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-715
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Andrew Sykes
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: elapsed_time.patch, UtilDateTime.java.patch, 
> UtilDateTime.java.patch
>
>
> 6 new methods, 
> 1/ adjustDateTime (3 methods) adjusts either a Timestamp Date or Calendar by 
> the given timeUomId and timeUomMultiple
> 2/ getTimeUomMultipleDifference (3 methods) gets the timeUomMultiple for two 
> Timestamp Date or Calendar objects given the timeUomId.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to