Skip to content
Back

[Solved] How to get documents using the between query on a datetime value in flutter/appwrite

  • 0
  • General
mc-stephen
22 Oct, 2023, 01:52

I am trying to select some documents btw some certain date range in Flutter using the appwrite adk for Flutter but when I pass the date value in string format using the query command I keep getting this error that says, >>> invalid query: Query type does not match expected: datetime <<<

Pls I need help in this, on how to fix it.

TL;DR
The user encountered an issue while trying to use the between query on a datetime value in the Flutter appwrite SDK. Another user suggested using the greater than and less than query instead, and also advised tweaking the datetime format using `.toUtc()` to match the server time zone. The issue was marked as solved.
Drake
22 Oct, 2023, 03:36

There might be a bug with the between query. I suggest using greater than and less than. Also, to format the datetime you can call datetime.toUtc().toIso8601String() or something like that

mc-stephen
22 Oct, 2023, 12:10

Okay, I will try that and get back to you. Thanks

mc-stephen
22 Oct, 2023, 13:59

Okay, thanks it worked, can believe this gave me issues, but using the less than and greater then query helps alot, seems like the between query have a bug in it 🤷.

Incase some one face the issue in the future, you might have to make some tweek on the datetime format cus you will be using .toUtc cus of the server time zone and that might not match well with your local time zone.

I simply just added one day to the days and use less than instead of less then and equal query.

Thanks 💯

mc-stephen
22 Oct, 2023, 14:02

[Solved] How to get documents using the between query on a datetime value in flutter/appwrite

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more