英文:
Best way of storing Date & Time in Kotlin
问题
我实际上有点迷茫。
我需要存储日期和时间以进行简单的使用,例如存储在数据库中,分段的可回收视图等,但关于如何保存日期和时间有太多选项,而且每篇文章都说其中一种方法优于其他方法。
有 Date、Calendar、LocalDateTime、Instant 等。
我的问题是,目前最佳的存储日期和时间的方式是什么?
英文:
I'm honestly kinda lost.
I need to store date & time for simple usage, for example storing in the database, sectioned recycler view etc, but there are too many options of how to save data&time, and every article say one is better than the other.
There are Date, Calendar, LocalDateTime, Instant etc
My question is what is the current best way of storing date and time?
答案1
得分: 1
最佳方法是将日期和时间存储为毫秒。将您的日期和时间转换为毫秒并存储它。
英文:
Best way to store date and time in millisecond. Convert your date and time to millisecond and store it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论