You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2010/09/17 12:40:20 UTC

svn commit: r998061 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

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) {



Re: svn commit: r998061 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
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 <ad...@hlmksw.com> 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, ashish@apache.org 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)
>> {
>>
>>
>>
>

Re: svn commit: r998061 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

Posted by Nicolas Malin <ma...@librenberry.net>.
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, ashish@apache.org 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/


Re: svn commit: r998061 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

Posted by Adrian Crum <ad...@hlmksw.com>.
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, ashish@apache.org 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) {
>
>
>