Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8197786

Calendar month start from 0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u161
    • core-libs

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)



      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [版本 10.0.16299.192]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8

      A DESCRIPTION OF THE PROBLEM :
      public static void main(String[] args) {
      Calendar cal = Calendar.getInstance();
      Date today = new Date(System.currentTimeMillis());
      cal.setTime(today);
      System.out.println(today);
      int month = cal.get(Calendar.MONTH);
      System.out.println(month);
      }

      Sun Feb 11 11:03:44 CST 2018
      1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public static void main(String[] args) {
      Calendar cal = Calendar.getInstance();
      Date today = new Date(System.currentTimeMillis());
      cal.setTime(today);
      System.out.println(today);
      int month = cal.get(Calendar.MONTH);
      System.out.println(month);
      }

      Sun Feb 11 11:03:44 CST 2018
      1


      REPRODUCIBILITY :
      This bug can be reproduced always.

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: