Hello, I want to get a list of Document by Query.between using date.
String today = DateTime.now().toString().substring(0, 10); // YYYY-MM-DD
String oneMonthAgo = DateTime.now().subtract(Duration(days: 30)).toString().substring(0, 10);
...
dataMonth = database.listDocuments(
databaseId: databaseId,
collectionId: collectionId,
queries: [
Query.between(
'\$createdAt',
oneMonthAgo,
today),
]
...
context.log("Documents");
dataMonth.documents.every(
(element) {
context.log(element.data['data']);
return true;
},
);
// Printed 1 document, expected 3 documents
There are 3 documents with the same CreatedAt date, but only one of them is returned. Is there anything I did wrong?
Reason: different timezone, about 6 hours before the server fix: add a whole day to DateTime today
String today = DateTime.now().add(Duration(days: 1)).toString().substring(0, 10);
String oneMonthAgo = DateTime.now().subtract(Duration(days: 31)).toString().substring(0, 10);
[SOLVED] Use Query.between() to list documents by date
Recommended threads
- help! I've been stuck on this for days, ...
help! I've been stuck on this for days, I'm a newbie. C:\Users\>curl -X POST https://cloud.appwrite.io/v1/functions/1/executions ^ More? -H "Content-Type: app...
- RealTime subscription to certain documen...
ive built a chat app, when i pull inboxes, i want to listen to changes to those inboxes. can i add a query to the a subscription, or i have to create a subscrip...
- Array max lenght
Hello everyone What is the maximum length of a string array (see attached image), like how many items can I add to the array before reaching the limit?