如何查询过去3天内创建的对象? [parse.com]

时间:2021-12-26 19:59:34

In my app users can post content and i want users to see content from the last 3 days. Is there a wherekey that I can have that only looks for posts from the last 3 days? I am using parse as my backend.

在我的应用中,用户可以发布内容,我希望用户能够查看过去3天内容。是否有一个我可以拥有的只能查找过去3天内帖子的地方?我使用解析作为我的后端。

1 个解决方案

#1


0  

You can use whereKey:greaterThan to solve this.

您可以使用whereKey:greaterThan来解决此问题。

let threeDaysAgo = NSDate().dateByAddingTimeInterval(-259200)
query.whereKey("createdAt", greaterThan: threeDaysAgo)

#1


0  

You can use whereKey:greaterThan to solve this.

您可以使用whereKey:greaterThan来解决此问题。

let threeDaysAgo = NSDate().dateByAddingTimeInterval(-259200)
query.whereKey("createdAt", greaterThan: threeDaysAgo)