【发布时间】:2018-03-11 15:57:02
【问题描述】:
我无法做到这一点,想知道如何根据设备具有的 local 显示 Firestore FieldValue.serverTimestamp() 格式个人。
Firestore timestamp 看起来像这样
2018 年 3 月 10 日星期六 19:42:32 GMT+01:00
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS", Locale.getDefault());
Date parsedDate = dateFormat.parse("Sat Mar 10 19:42:32 GMT+01:00 2018");
txtCreationDate.setText(new Date(parsedDate.getTime()).toString());
} catch (ParseException e) {
txtCreationDate.setText("time error");
}
如果一个用户在美国创建日期时间对象,那么如果另一个用户在意大利查看它,那么创建时间必须调整到他的时钟
我已经阅读了很多关于此的页面,但 dateFormat 解析器只给我错误。
请指教
【问题讨论】:
标签: android localization google-cloud-firestore datetime-format