GAE java jdo where date < mydate

:foo & q.execute(new Foo())
que.setFilter("date < :datetime");
final List<Tidder> list = (List<Tidder>) que.execute(new Date());
public class Recent extends HttpServlet
{
    @SuppressWarnings("unchecked")
	@Override
    public void doGet(final HttpServletRequest req, final HttpServletResponse res)
    {
    	 String _datetime = req.getParameter("datetime");
    	 Date datetime = null;
    	 try {
			datetime = (_datetime==null)?new Date():(_datetime.isEmpty())?new Date():(!_datetime.matches("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"))?new Date():new SimpleDateFormat("yyyyMMddHHmmss").parse(_datetime);
    	 } catch (ParseException e1) { // impossible
    	 }
    	 final PersistenceManager pm = PMF.get().getPersistenceManager();
         final String query = "select from " + Tidder.class.getName();
         final Query que = pm.newQuery(query);
         que.setFilter("date < :datetime");
         que.setOrdering("date descending");
         que.setRange(0, 12);
         final List<Tidder> list = (List<Tidder>) que.execute(datetime);
         try
         {
             res.setContentType("text/html");
             res.setCharacterEncoding("UTF-8");
             final PrintWriter out = res.getWriter();
             out.write("<ul id='recent'>");
             for (final Tidder t : list)
             {
            	 cal.setTime(t.date());
                 out.write("<li timestamp='"+new SimpleDateFormat("yyyyMMddHHmmss").format(t.date())+"'><a href=\"/wiki/"+t.name()+"\"><div class='timestamp'><span class='month'>" + MONTH[cal.get(Calendar.MONTH)] + "</span><span class='date'>" + cal.get(Calendar.DAY_OF_MONTH) + "</span></div><span class='wiki'>" + t.name()+ "</span></a></li>");
             }
             out.write("</ul>");
         }
         catch (final IOException e)
         {
             e.printStackTrace();
         }
    }
    
    
    private Calendar cal = new GregorianCalendar();
    private static String[] MONTH = new String[]{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
}
Result /recent /raw/Recent
    last modified: 19 July 2011 [ View wiki source Close ]
     
SEARCH DIFFERENCE ATTACHMENT RECENT POST