I use cloud firestore!
I was unable to solve this problem. I get this error:
com.google.firebase.Timestamp cannot be cast to java.util.Date
but I think the converter I have already created inside Adapter.
the pictures you see all the details of the code
try out the following code if you want timestamp
val timestamp = data[TIMESTAMP] as Timestamp
and if you want date object from timestamp
val date = timestamp.toDate()
The answer above has got the right idea but you need to change it a little. You need to cast it as a firebase timestamp for it to work.
val timestamp = data[TIMESTAMP] as com.google.firebase.Timestamp
val date = timestamp.toDate()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.