Pat Farrell wrote:So far, I've been adding 24 hours, which seems to be the same, but the code is ugly.
Is there a better way?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:Yes. Calendar.add(). And furthermore, I believe it takes DST into account.
Pat Farrell wrote:I know about Calendar.add, my question is does Calendar.DATE really mean Calendar.DAY?
Paul Clapham wrote:And when you have to add hours, let me warn you in advance not to confuse Calendar.HOUR with Calendar.HOUR_OF_DAY.
Pat Farrell wrote:DAY_OF_MONTH is not at all what I want.
Paul Clapham wrote:
Pat Farrell wrote:DAY_OF_MONTH is not at all what I want.
Why not? Isn't DAY_OF_MONTH exactly parallel to MONTH in the context of adding 1 to it?
Junilu Lacar wrote:JavaDocs say that Calendar.DAY_OF_MONTH ... is a synonym for Calendar.DATE and vice versa.
Pat Farrell wrote:If it is dangerous to use Calendar.HOUR_OF_DAY instead of Calendar.HOUR,
it sure feels equally dangerous to use DATE when I really want DAY. not only is there no DAY, but there is no discussion in the javadocs of how to simply add one day.
Pat Farrell wrote:
But the primary storage of a Calendar object is just the elapsed time in milliseconds from a date long ago (1970). So there really is not a concept of DST without applying a Locale to it.Winston Gutkowski wrote:Yes. Calendar.add(). And furthermore, I believe it takes DST into account.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Pat Farrell wrote:
Junilu Lacar wrote:JavaDocs say that Calendar.DAY_OF_MONTH ... is a synonym for Calendar.DATE and vice versa.
Yes, but there is no Calendar.DAY
If it is dangerous to use Calendar.HOUR_OF_DAY instead of Calendar.HOUR,
it sure feels equally dangerous to use DATE when I really want DAY. not only is there no DAY, but there is no discussion in the javadocs of how to simply add one day.
I can trivially write a few test cases, but that doesn't prove that its working correctly, only that my test cases passed.