svn commit: r786400 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java

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

svn commit: r786400 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java

apatel-2
Author: apatel
Date: Fri Jun 19 07:34:06 2009
New Revision: 786400

URL: http://svn.apache.org/viewvc?rev=786400&view=rev
Log:
Part of code from OFBIZ-2627. Thanks.

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

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java?rev=786400&r1=786399&r2=786400&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java Fri Jun 19 07:34:06 2009
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.base.util;
 
+import java.sql.Timestamp;
 import java.util.Calendar;
 import java.util.Collection;
 
@@ -895,7 +896,24 @@
             return false;
         }
     }
-
+    
+    public static boolean isDateBeforeNow(Timestamp  date) {
+        Timestamp now = UtilDateTime.nowTimestamp();
+        if (date != null) {
+            return date.before(now);
+        } else {
+            return false;
+        }
+    }
+    
+    public static boolean isDateAfterNow(Timestamp  date) {
+        Timestamp now = UtilDateTime.nowTimestamp();
+        if (date != null) {
+            return date.after(now);
+        } else {
+            return false;
+        }
+    }
     /** isTime returns true if string arguments hour, minute, and second form a valid time. */
     public static boolean isTime(String hour, String minute, String second) {
         // catch invalid years(not 2- or 4-digit) and invalid months and days.