How to convert timestamped retrieved from firebase firestore database and compare it with the current date and time.
db.collection("users").document(user.getuid).get()
.addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
String date = documentSnapshot.getData().get("last_login_date").toString();
}
});
Conver the date to readable and deduct it from the current time to show the difference in days, hours and minutes
The output of date variable is in below format
Timestamp(seconds=1558532829, nanoseconds=284000000)