it worked for me when i do small change in model class by replacing
Map<String , String> timestamp;
with
Object timestamp;
as Object class is the parent of all classes in java so any subclass will work fine with it as when you save the value in firebase it's ok and when retrieve value all just you need is to cast this object to Long
here's my Model i used
public class UserModel {
private String name , phone, email, birthDate, userType, address;
Object timestamp;
// for firebase retrieving data
public UserModel() {
}
public UserModel(String name, String phone, String email, String birthDate, String userType, String address) {
this.name = name;
this.phone = phone;
this.email = email;
this.birthDate = birthDate;
this.userType = userType;
this.address = address;
//get Date from firebase server automatic
this.timestamp = ServerValue.TIMESTAMP;
}
public String getName() {
return name;
}
public String getPhone() {
return phone;
}
public String getEmail() {
return email;
}
public String getBirthDate() {
return birthDate;
}
public String getUserType() {
return userType;
}
public String getAddress() {
return address;
}
@Override
public String toString() {
String data = " user name" + this.name+" , user Address : "
+this.address+" , user phone "+this.phone+" , user email : "+this.email
+" , user birthdate : "+this.birthDate+" , user type : "+this.userType
+ " , registered time "+this.timestamp;
return data;
}
/* public String getLoginDate() {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.mmm'Z'");
Date date = new Date(si)
return ;
}*/
}
and i uploaded it in firebase successufly

and here is the reslt i recieved when download data from firebase
