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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

hansbak-2
Author: hansbak
Date: Sat Dec  8 23:58:41 2007
New Revision: 602650

URL: http://svn.apache.org/viewvc?rev=602650&view=rev
Log:
show number of days between timestamps and add a day to a timestamp. I realize this is perhaps not the best method, but it works. If somebody has suggestions to do it better, pleae let me now, i will change it....

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java?rev=602650&r1=602649&r2=602650&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilDateTime.java Sat Dec  8 23:58:41 2007
@@ -75,6 +75,14 @@
         return thru != null ? thru.getTime() - from.getTime() : 0;
     }
 
+    public static int getIntervalInDays(Timestamp from, Timestamp thru) {
+        return thru != null ? (int) (thru.getTime() - from.getTime()) / (24*60*60*1000) : 0;
+    }
+
+    public static Timestamp addDaysToTimestamp(Timestamp start, int days) {
+        return new Timestamp(start.getTime() + (24*60*60*1000*days));
+    }
+
     public static double getInterval(Timestamp from, Timestamp thru) {
         return thru != null ? thru.getTime() - from.getTime() + (thru.getNanos() - from.getNanos()) / 1000000 : 0;
     }