java - Google App Engine query filter by date -


how gae filter query results date?

i'm trying pass datestamp through query can't work.

in google dashboard datastore viewer date field stored gd:when type format: yyyy-mm-dd hh:mm:ss when displayed on webpage displays mon jul 15 20:15:35 utc 2013.

i request string mon jul 15 20:15:35 utc 2013 jsp page , parse filter isn't working.

    string strdatestamp = req.getparameter("stamp");     string formatstring = "eee mmm dd hh:mm:ss z yyyy";     date datestamp = null;     try {         datestamp = new simpledateformat(formatstring).parse(strdatestamp);     } catch (parseexception e) {         e.printstacktrace();     }     filter filter = new filterpredicate                            ("date", query.filteroperator.equal, datestamp);     query query = new query("example", key).setfilter(filter); 

date in computer systems represented time, in particular case it's internally represented unix time in milliseconds. see yourself: date.gettime().

what see human-readable representation, lacks full millisecond precision.

to query particular second need query particular time range within 1 second. need range query between mon jul 15 20:15:35 utc 2013 , mon jul 15 20:15:36 utc 2013 (note second change):

filter startfilter = new filterpredicate("date", query.filteroperator.greater_than_or_equal, startsecond); filter endfilter = new filterpredicate("date", query.filteroperator.less_than, nextsecond); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -