The docs say that Date.UTC() is deprecated and should be replaced with some untrivial spell with Calendar
(magic phrase, I mean). A bit more extensive search tells me that the proposed remedy is no better and Calendar
is arguably the worst JDK API.
Finally I found joda-time-android.
But what I have not seen is one concise, simple explanation (and not an obscure reference to "internationalization problems"):
1) Why Date
is bad,
2) Why Date.UTC()
is bad, and
3) Why Calendar
& friends are bad.
These classes may have problems for the general case, but probably they are ok for my specific problem?
For example, Date is mutable, it is wrong in the long run, but I myself can live with that right now. Yes, the ranges are crazy, but after I add/subtract 1, will I have other problems?
(What I need right now boils down to an alarm-clock that works across time zones. No dates-without-time or dates-in-documents, leap seconds are irrelevant.)
EDIT Folks, I understand that this question and Should I use Java date and time classes or go with a 3rd party library like Joda Time? are roughly about the same topic, but the questions are different:
1) Android means restricted resources, therefore there is a counter-argument of 100+ classes in the .apk
2) My question is different: the question Why Date/Calendar is bad? means that I want to know what problems will be there if I decide to use these classes. I want a concise explanation of the reasons behind the story with these date/time classes.