Order query results by date (String) for GAE

I have thousands of objects stored in the GAE data warehouse, where the "create" field is saved as a date String(standard format).

My question will be whether it is possible to do Queryas follows:

Query q = new Query("Post")
                .addSort("created", SortDirection.DESCENDING);

Where " created" is actually a date string, stored as follows: 2014-12-11T14:31:43 -08:00" and actually get a decreasing order. I tried, but the result set is also random and not even ordered by date.

Is there a way to configure GAE Queryto achieve this using this data?

+1
source share
2 answers

GAE , '2014-12- 11 T14: 31: 43 -08: 00' '2014-12- 04 T14: 31: 43 -08: 00 '(,), .

'created'? , GAE , .

+2

.

.

import java.util.Date;

Date created = new Date();
Post.setProperty("created", created);

, , , .

0

All Articles