[appengine-java] Re: Filtering by Date using the Datastore Low Level API

2009-11-27 Thread dflorey
The filter will just do string comparison (how should it know that you
are comparing dates??)
To get proper sorting/filtering just store the date as time in millis
and it will work.

Cheers,
Daniel

On 27 Nov., 04:25, Doug  wrote:
> Good Evening Everyone,
>
> I am working on creating an event calendar type of page and am having
> trouble using the low level API and applying a filter to select events
> that occur in the future.  The data that I am selecting has a property
> of "display_until" that holds a date in -mm-dd hh:mm:ss format.
>
> To select future events I started with the following code:
>                 SimpleDateFormat formatter;
>                 formatter = new SimpleDateFormat("-mm-dd hh:mm:ss");
>                 Date date = new Date();
>                 String query_date = formatter.format(date);
>
>                 query.addSort("display_until", Query.SortDirection.ASCENDING);
>                 query.addFilter("display_until",
> com.google.appengine.api.datastore.Query.FilterOperator.GREATER_THAN,
> query_date);
>
> When I ran this code it did select future events, but not all of
> them.  Currently I have some 2009 and some 2010 events.  It selected
> the 2010 events, but not the December 2009 events.
>
> Anyone have any suggestions for how I can select all of the future
> events?
>
> Thanks,
> Doug

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Filtering by Date using the Datastore Low Level API

2009-11-27 Thread Henri
I'm storing java.util.Date instances and filters work flawlessly.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Filtering by Date using the Datastore Low Level API

2009-11-27 Thread m seleron
Hi,

Though it might be unrelated.
I think that Date and Time Patterns of SimpleDateFormat is [MM] Month
in year [mm] Minute in hour.

thanks.

On 11月27日, 午後7:22, dflorey  wrote:
> The filter will just do string comparison (how should it know that you
> are comparing dates??)
> To get proper sorting/filtering just store the date as time in millis
> and it will work.
>
> Cheers,
> Daniel
>
> On 27 Nov., 04:25, Doug  wrote:
>
> > Good Evening Everyone,
>
> > I am working on creating an event calendar type of page and am having
> > trouble using the low level API and applying a filter to select events
> > that occur in the future.  The data that I am selecting has a property
> > of "display_until" that holds a date in -mm-dd hh:mm:ss format.
>
> > To select future events I started with the following code:
> >                 SimpleDateFormat formatter;
> >                 formatter = new SimpleDateFormat("-mm-dd hh:mm:ss");
> >                 Date date = new Date();
> >                 String query_date = formatter.format(date);
>
> >                 query.addSort("display_until", 
> > Query.SortDirection.ASCENDING);
> >                 query.addFilter("display_until",
> > com.google.appengine.api.datastore.Query.FilterOperator.GREATER_THAN,
> > query_date);
>
> > When I ran this code it did select future events, but not all of
> > them.  Currently I have some 2009 and some 2010 events.  It selected
> > the 2010 events, but not the December 2009 events.
>
> > Anyone have any suggestions for how I can select all of the future
> > events?
>
> > Thanks,
> > Doug

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Filtering by Date using the Datastore Low Level API

2009-11-27 Thread Doug

Correcting the SimpleDateFormat solved the problem.  Thank you for
catching that!

Doug

On Nov 27, 5:26 am, m seleron  wrote:
> Hi,
>
> Though it might be unrelated.
> I think that Date and Time Patterns of SimpleDateFormat is [MM] Month
> in year [mm] Minute in hour.
>
> thanks.
>
> On 11月27日, 午後7:22, dflorey  wrote:
>
>
>
> > The filter will just do string comparison (how should it know that you
> > are comparing dates??)
> > To get proper sorting/filtering just store the date as time in millis
> > and it will work.
>
> > Cheers,
> > Daniel
>
> > On 27 Nov., 04:25, Doug  wrote:
>
> > > Good Evening Everyone,
>
> > > I am working on creating an event calendar type of page and am having
> > > trouble using the low level API and applying a filter to select events
> > > that occur in the future.  The data that I am selecting has a property
> > > of "display_until" that holds a date in -mm-dd hh:mm:ss format.
>
> > > To select future events I started with the following code:
> > >                 SimpleDateFormat formatter;
> > >                 formatter = new SimpleDateFormat("-mm-dd hh:mm:ss");
> > >                 Date date = new Date();
> > >                 String query_date = formatter.format(date);
>
> > >                 query.addSort("display_until", 
> > > Query.SortDirection.ASCENDING);
> > >                 query.addFilter("display_until",
> > > com.google.appengine.api.datastore.Query.FilterOperator.GREATER_THAN,
> > > query_date);
>
> > > When I ran this code it did select future events, but not all of
> > > them.  Currently I have some 2009 and some 2010 events.  It selected
> > > the 2010 events, but not the December 2009 events.
>
> > > Anyone have any suggestions for how I can select all of the future
> > > events?
>
> > > Thanks,
> > > Doug

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.