I've a field name called PurchaseDate
in every document of Cloud Firestore. Now I want to get all documents where the year in PurchaseDate is 2019.
In Firestore date timestamp is store as below screenshot
I've a field name called PurchaseDate
in every document of Cloud Firestore. Now I want to get all documents where the year in PurchaseDate is 2019.
In Firestore date timestamp is store as below screenshot
When using the following lines of code:
String queryDate = "16-01-2019";
database.collection("Abcdt/currenUser/EFC").whereEqualTo("PurchaseDate", queryDate).get();
It means that you are trying to query the database using a literal String, which is not correct since in your database your PurchaseDate
property is of type Date
. So to solve this, instead of passing as a the second argument a String, pass a Date
object.