Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    (As an aside, you realize you're finding the difference between "April 31st" and February 1st, right? Months are 0-based in Calendar...) Commented Sep 7, 2015 at 14:22
  • Use java.time, the modern Java date and time API since Java 8, for all of your date work. You are demonstrating quite nicely that one cannot work reliably with GregorianCalendar. Commented Aug 1 at 6:26
  • 1
    maybe an odd behaviour, but as specified/documented -- one more reason to stop using these classes and switch to the java.time ones Commented Aug 1 at 6:37