我尝试做的是在一个日期范围内每小时获取一行数据。我见过一些使用sql的例子,我想我不能用android ParsePlatform库来做这些事情……
所以我的想法是,也许有一种方法可以查询时间戳在00的+- 5分钟内的所有行,这是可能的吗,或者我如何实现我的最终目标?
发布于 2021-11-02 16:51:13
为此,您可以使用whereGreaterThanOrEqualTo和whereLessThanOrEqualTo函数。它应该是这样的:
ParseQuery<ParseObject> query = ParseQuery.getQuery("ClassName");
query.whereGreaterThan("yourDateFieldName", new Date(someDate.getTimeInMillis() - 5 * 60 * 1000));
query.whereLessThanOrEqualTo("yourDateFieldName", new Date(someDate.getTimeInMillis() + 5 * 60 * 1000));
query.findInBackground(new FindCallback< ParseObject >() {
void done(List<ParseObject> results, ParseException e) {
// results has the list of objects matching the query
}
});https://stackoverflow.com/questions/69805632
复制相似问题