A better approach would be to use the org.ofbiz.base.util.TimeDuration
class.
The <call-class-method> element is deprecated.
Never use millisecond arithmetic.
Adrian Crum
Sandglass Software
www.sandglass-software.com
On 12/24/2014 2:58 PM, Jad El Omeiri wrote:
Hi Vivek,
1)
If you want to do the calculation in XML (in screen widgets), I would
suggest calling a java method like that:
<call-class-method class-name="org.ofbiz.base.util.UtilDateTime OR whatever
class that contains the method" method-name="methodName"
ret-field="resultVariable">
<field field="date1" type="java.sql.Timestamp"/>
<field field="date2" type="java.sql.Timestamp"/>
</call-class-method>
2)
If you want to do it in ftl, just subtract the 2 dates and divide by
1000*60*60*24. Make sure the dates are both correctly formatted.
Take a look at that:
http://stackoverflow.com/questions/11412040/how-do-i-calculate-the-difference-in-days-between-two-iso8601-dates-with-freemar
Hope that helps.
Cheers,
-----
Jad El Omeiri
--
View this message in context:
http://ofbiz.135035.n4.nabble.com/Calculate-date-difference-in-days-tp4660532p4660551.html
Sent from the OFBiz - User mailing list archive at Nabble.com.