Thanks Peter, it functions for me too with MySql on DATETIME columns. However because of the strange way needed to add the criteria I wonder if it functions accidentaly or if it is really portable.
Marc. ----- Original Message ----- From: "Peter Courcoux" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.jakarta.turbine.torque.user Sent: Tuesday, January 07, 2003 5:25 PM Subject: Re: Query on date field: pb with Criteria.addDate > Marc, > > Try criteria.add(YourtablePeer.YOURCOLUMN, (Object) date, > Criteria.COMPARISON) > > This works for me using postgresql where date is a java.util.Date object > and the column is type TIMESTAMP. I'm not sure that I have tried other > column types or db's. > > I hope that this helps. > > Peter > > > > On Tue, 2003-01-07 at 15:50, Marc Guillemot wrote: > > Does someone use Criteria.addDate? > > I'm always stuck with this problem. > > > > Marc. > > > > ----- Original Message ----- > > From: "Marc Guillemot" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, December 20, 2002 6:31 PM > > Subject: Query on date field: pb with Criteria.addDate > > > > > > > Hi, > > > > > > I want to perform a doSelect with a criteria on a date field. > > > I've tryed > > > Criteria.addDate > > > and > > > Criteria.add with a GregorianCalendar as parameter > > > but in both cases I get an sql error (I use MySQL with the > > > org.gjt.mm.mysql.Driver driver) because the generated sql query just > > > contains the toString() representation of the GregorianCalendar: > > > > > > SELECT Tasks.ID, Tasks.WORKERID, Tasks.STARTDATE, Tasks.ENDDATE, > > > Tasks.PAUSE, Tasks.DESCRIPTION, Tasks.COMMENT, Tasks.STATUS, > > > Tasks.VALIDATORID, Tasks.VALIDATIONDATE FROM Tasks WHERE > > > > > Tasks.ENDDATE<=java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllF > > > > > ieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berli > > > > > n",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRu > > > > > le=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=36000 > > > > > 00,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDa > > > > > yOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,e > > > > > ndDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysIn > > > > > FirstWeek=4,ERA=1,YEAR=2002,MONTH=11,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_M > > > > > ONTH=1,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=?,HOUR=?,HOU > > > R_OF_DAY=?,MINUTE=?,SECOND=?,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?] > > > > > > Does Torque provide a way to perform a query with criteria on date fields? > > > > > > Marc. > > > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- > Peter Courcoux <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
