A quick reminder to the rest of the community: UtilDateTime methods that
perform millisecond arithmetic should not be used. -Adrian On 9/17/2010 3:40 AM, [hidden email] wrote: > Author: ashish > Date: Fri Sep 17 10:40:20 2010 > New Revision: 998061 > > URL: http://svn.apache.org/viewvc?rev=998061&view=rev > Log: > Correcting the condition. Thanks Akash for the contribution. > > Modified: > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java > > Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=998061&r1=998060&r2=998061&view=diff > ============================================================================== > --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java (original) > +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java Fri Sep 17 10:40:20 2010 > @@ -76,7 +76,7 @@ public class UtilDateTime { > } > > public static int getIntervalInDays(Timestamp from, Timestamp thru) { > - return thru != null ? (int) (thru.getTime() - from.getTime()) / (24*60*60*1000) : 0; > + return thru != null ? (int) ((thru.getTime() - from.getTime()) / (24*60*60*1000)) : 0; > } > > public static Timestamp addDaysToTimestamp(Timestamp start, int days) { > > > |
Le 17/09/2010 17:05, Adrian Crum a écrit :
> A quick reminder to the rest of the community: UtilDateTime methods > that perform millisecond arithmetic should not be used. I understand that 24*60*60*1000 it's bad, but for my culture, Why millisecond arithmetic should not be used ? If you have just a link ;) Nicolas > > -Adrian > > On 9/17/2010 3:40 AM, [hidden email] wrote: >> Author: ashish >> Date: Fri Sep 17 10:40:20 2010 >> New Revision: 998061 >> >> URL: http://svn.apache.org/viewvc?rev=998061&view=rev >> Log: >> Correcting the condition. Thanks Akash for the contribution. >> >> Modified: >> >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> >> Modified: >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=998061&r1=998060&r2=998061&view=diff >> >> ============================================================================== >> >> --- >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> (original) >> +++ >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> Fri Sep 17 10:40:20 2010 >> @@ -76,7 +76,7 @@ public class UtilDateTime { >> } >> >> public static int getIntervalInDays(Timestamp from, Timestamp >> thru) { >> - return thru != null ? (int) (thru.getTime() - >> from.getTime()) / (24*60*60*1000) : 0; >> + return thru != null ? (int) ((thru.getTime() - >> from.getTime()) / (24*60*60*1000)) : 0; >> } >> >> public static Timestamp addDaysToTimestamp(Timestamp start, int >> days) { >> >> >> -- Nicolas MALIN Consultant Tél : 06.17.66.40.06 Site projet : http://www.neogia.org/ ------- Société LibrenBerry Tél : 02.48.02.56.12 Site : http://www.librenberry.net/ |
In reply to this post by Adrian Crum
Thanks so much Adrian for your comment.
Are you recommending to look into the classes present inside "conversion" package(org.ofbiz.base.conversion)? This is what I am assuming at the moment - Please confirm! -- Ashish On Fri, Sep 17, 2010 at 8:35 PM, Adrian Crum <[hidden email]> wrote: > A quick reminder to the rest of the community: UtilDateTime methods that > perform millisecond arithmetic should not be used. > > -Adrian > > On 9/17/2010 3:40 AM, [hidden email] wrote: >> >> Author: ashish >> Date: Fri Sep 17 10:40:20 2010 >> New Revision: 998061 >> >> URL: http://svn.apache.org/viewvc?rev=998061&view=rev >> Log: >> Correcting the condition. Thanks Akash for the contribution. >> >> Modified: >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> >> Modified: >> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=998061&r1=998060&r2=998061&view=diff >> >> ============================================================================== >> --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> (original) >> +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java >> Fri Sep 17 10:40:20 2010 >> @@ -76,7 +76,7 @@ public class UtilDateTime { >> } >> >> public static int getIntervalInDays(Timestamp from, Timestamp thru) { >> - return thru != null ? (int) (thru.getTime() - from.getTime()) / >> (24*60*60*1000) : 0; >> + return thru != null ? (int) ((thru.getTime() - from.getTime()) / >> (24*60*60*1000)) : 0; >> } >> >> public static Timestamp addDaysToTimestamp(Timestamp start, int days) >> { >> >> >> > |
Free forum by Nabble | Edit this page |