在我的 Book 课中,我有几个字段。其中之一是 additionTime ,我需要在此字段中获取服务器时间戳。我的课在这里
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;
}
}
但是在 additionTime 字段中,我变得像 UTC + 6,2019年8月17日晚上10:03:28 ,我如何获得Unix时间戳?例如1566058638。