What are the alternative classes for localTime and localDate in Android? [duplicate]

别来无恙 提交于 2020-07-20 07:50:29

问题


I want to use long value I got from android API that return me dates as longs, represented as milliseconds since Epoch.

I need to use methods like isBefore() plusDays() isAfter()

Cursor managedCursor = getContentResolver().query(CallLog.Calls.CONTENT_URI,
                    new String[]{"number", "type", "date", "duration", "name"},
                    null, null, strOrder);

In java I can use LocalDate and LocalTime classes to handle this, unfortunately these classes don't exist on android so what classes available on android similar to localdate and localtime?


回答1:


https://github.com/dlew/joda-time-android

This is the library that most use for time in Android. A bit heavy on size, but if that's not an issue then it's way better than using utils Android gives you



来源:https://stackoverflow.com/questions/37225393/what-are-the-alternative-classes-for-localtime-and-localdate-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!