"JAVA" Jdk-calendar encountered a pit

Source: Internet
Author: User

Calendar is an added class of JDK 1.1 recently used the next calendar to find a few very maddening questions Source:Public final static int SUNDAY = 1;Public final static int MONDAY = 2;Public final static int Tuesday = 3;Public final static int Wednesday = 4;Public final static int Thursday = 5;Public final static int FRIDAY = 6;Public final static int SATURDAY = 7;Did you find out? Yes, it's true, Monday. (MONDAY) The corresponding value is 2, not one, and the other values are backwards 1 digits. The same, source code:Public final static int January = 0; Public final static int February = 1;Public final static int March = 2;Public final static int APRIL = 3;Public final static int may = 4;Public final static int JUNE = 5;Public final static int july = 6;Public final static int August = 7;Public final static int September = 8;Public final static int october = 9;Public final static int November = ten;Public final static int december = one;Yes, the month also has the same problem. You can handle the wrong time.

"JAVA" Jdk-calendar encountered a pit

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.