hi frank,
what is the result you get?
i would try it that way:
Calendar c = new GregorianCalendar();
c.add(Calendar.DATE, -60);
SelectQuery select = new SelectQuery(HRApplications.class, ExpressionFactory.between);
List records = context.performQuery(select, ExpressionFactory.betweenExp("appDate", c, new GregorianCalendar()));
return records;
-----Ursprüngliche Nachricht-----
Von: Frank [mailto:farocc..otmail.com]
Gesendet: Freitag, 16. März 2007 14:46
An: use..ayenne.apache.org
Betreff: How do I filter on mysql date?
Hello,
I need to show the last 60 days of records from my MySQL database.
This is not working.
private List filter() {
Calendar c = new GregorianCalendar();
c.set(c.get(Calendar.YEAR),(c.get(Calendar.MONTH)-60), 1, 0, 0, 0);
DataContext context = DataContext.getThreadDataContext();
Expression qualifier3 = Expression.fromString("appDate > $date");
qualifier3 = qualifier3.expWithParameters(Collections.singletonMap("date", c.getTime()));
SelectQuery select3 = new SelectQuery(HRApplications.class, qualifier3);
List records = context.performQuery(select3);
return records;
}
What am I doing wrong?
Thanks
Frank
This archive was generated by hypermail 2.0.0 : Fri Mar 16 2007 - 10:15:17 EDT