In my Book class , I have several fields. One of them is additionTime, I need to get server timestamp in this field. My class is here
public class Book{
private String bookId;
private String bookName;
private String authors;
private float rating;
private String category;
private String thumbnail;
private BookState bookState;
private long additionTime;
private String ownerID;
public Book(){
}
//other getter and setters
public FieldValue getAdditionTime(){
return FieldValue.serverTimestamp();
}
@Exclude
public long getAdditionTimeLong(){
return additionTime;
}
public void setAdditionTime(long additionTime) {
this.additionTime = additionTime;
}
}
But in additionTime field I'm getting like August 17, 2019 at 10:03:28 PM UTC+6, how can I get Unix Timestamp? like 1566058638.