更新时间:2023-11-29 08:13:10
您无法在Firebase Realtime数据库中添加类型LocalDate
的属性,因为它不是 href ="https://firebase.google.com/docs/database/android/read-and-write" rel ="nofollow noreferrer">支持的数据类型.但是,有两种方法可以解决此问题:
There is no way you can add a property of type LocalDate
in a Firebase Realtime database because it is not a supported data-type. However, there are two ways in which you can solve this:
将日期另存为ServerValue.TIMESTAMP
,这基本上意味着您保存了自Unix时代以来经过的秒数.在这种情况下,服务器将当前日期写入数据库中.要实现这一点,请从以下帖子中查看我的答案:
You save the date as a ServerValue.TIMESTAMP
, which basically means that you save the number of seconds that have elapsed since the Unix epoch. In this case, the server writes the current date in the database. To achieve this, please see my answer from the following post: