I am currently creating an Android app, but I'm not sure which class is best used.
What do I need to do with the dates I'm working with, such things as comparing dates, getting the difference between them, and calculating by date (for example, adding / subtracting a short period of time, for example, two weeks or a month before any date).
I know that the standard Date class in the Java API is terrible, so I'm just wondering which classes are recommended?
I saw the GregorianCalendar class and the Joda time library. However, I read a post stating that, due to the size of the Joda Time library, it is not recommended for applications.
Any help would be greatly appreciated. ^^
Edit: After a comment from 404notfound, I decided to go with the Calendar interface. This is connected to the Calendar interface automatically, using the best implementation based on the locale and time zone of the user device. This would make it more flexible than its GregorianCalendar implementation (or other specific implementations) in terms of the places where you can run it.
Hope this helps someone else with the same riddle!
Edit # 2: After further exploring the link provided by Nguyễn Hoài Nam, I went with the ThreeTenABP library, as it is a wrapper for the new Time class, introduced in Java 8, and will be freer to use than the calendar approach.
java android date
Liam Kelly
source share