Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何从Firestore存储和获取时间?_Android_Google Cloud Firestore - Fatal编程技术网

Android 如何从Firestore存储和获取时间?

Android 如何从Firestore存储和获取时间?,android,google-cloud-firestore,Android,Google Cloud Firestore,在Firestore中,我有两个心房将startTime和endTime存储为long-timemilis 我应该在firestore中将这两个属性存储为数字字段还是时间戳字段?通常人们使用时间戳类型字段来存储时间。获取时,您可以将它们转换为日期对象,然后使用您想要比较和格式化日期对象的任何实用程序。Android平台内置了许多选项。因此,在我的模型类中,我创建了两个属性“private Timestamp starTime”和“private Timestamp endTime”,在Timep

在Firestore中,我有两个心房将
startTime
endTime
存储为
long-timemilis


我应该在firestore中将这两个属性存储为数字字段还是时间戳字段?

通常人们使用时间戳类型字段来存储时间。获取时,您可以将它们转换为日期对象,然后使用您想要比较和格式化日期对象的任何实用程序。Android平台内置了许多选项。

因此,在我的模型类中,我创建了两个属性“private Timestamp starTime”和“private Timestamp endTime”,在Timepicker中,我需要设置这些对象上的时间,我该怎么做?”工作日程模型。设置开始时间(小时/天+分钟);'使用时间戳类构造函数。