You should be able to subtract one datetime from another datetime. If a-b>0 then a is after than b, if a-b<0, then b is after a. if a=b they are the same. i know there are at least a couple of examples of this in bsh files throughout the code base
--- Jacopo Cappellato <[EMAIL PROTECTED]> wrote: > Hi John, > > I don't remember if we have something similar in > OFBiz, but if not I > think it is a good idea to include it; maybe I'd > prefer to include the > commons validator jar (and also the commons math jar > > http://jakarta.apache.org/commons/math/ would be > interesting for reports > etc... but this is anoether subject). > > In the meantime, thanks for your ideas and research, > > Jacopo > > John Martin wrote: > > Hi All, > > > > I searched through the code base looking for a > simple date comparison > > method to compare two dates excluding time. I was > unable to find one. > > Is there one that I can use? > > > > I want the ability to compare data A to B and > determine if it is <, =, > > or >. I've writen one, compareDates(Date A, Date > B) compares the day, > > month and year of two dates, returing 0, -1 or +1 > indicating whether > > the first date is equal, before or after the > second. > > > > If there isn't one, I propose adding my method to > the > > > framework\base\src\base\org\ofbiz\base\util\UtilDateTime.java > class. > > > > There is a method in commons validation jar but > this jar is not > > included in the distro. > > > http://jakarta.apache.org/commons/validator/apidocs/org/apache/commons/validator/routines/DateValidator.html > > > > > > > Should we include my method or the commons > validator jar? > > > > Thanks, > > > > John > >
