< prev index next >

src/java.base/share/classes/java/time/chrono/package-info.java

Print this page




  80  * See {@link java.time.chrono.ChronoLocalDate ChronoLocalDate}
  81  * for a full discussion of the issues.
  82  * </p>
  83  * <p>
  84  * Using non-ISO calendar systems in an application introduces significant extra complexity.
  85  * Ensure that the warnings and recommendations in {@code ChronoLocalDate} have been read before
  86  * working with the "chrono" interfaces.
  87  * </p>
  88  * <p>
  89  * The supported calendar systems includes:
  90  * </p>
  91  * <ul>
  92  * <li>{@link java.time.chrono.HijrahChronology Hijrah calendar}</li>
  93  * <li>{@link java.time.chrono.JapaneseChronology Japanese calendar}</li>
  94  * <li>{@link java.time.chrono.MinguoChronology Minguo calendar}</li>
  95  * <li>{@link java.time.chrono.ThaiBuddhistChronology Thai Buddhist calendar}</li>
  96  * </ul>
  97  *
  98  * <h2>Example</h2>
  99  * <p>
 100  * This example lists todays date for all of the available calendars.
 101  * </p>
 102  * <pre>
 103  *   // Enumerate the list of available calendars and print todays date for each.
 104  *       Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
 105  *       for (Chronology chrono : chronos) {
 106  *           ChronoLocalDate date = chrono.dateNow();
 107  *           System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
 108  *       }
 109  * </pre>
 110  *
 111  * <p>
 112  * This example creates and uses a date in a named non-ISO calendar system.
 113  * </p>
 114  * <pre>
 115  *   // Print the Thai Buddhist date
 116  *       ChronoLocalDate now1 = Chronology.of("ThaiBuddhist").dateNow();
 117  *       int day = now1.get(ChronoField.DAY_OF_MONTH);
 118  *       int dow = now1.get(ChronoField.DAY_OF_WEEK);
 119  *       int month = now1.get(ChronoField.MONTH_OF_YEAR);
 120  *       int year = now1.get(ChronoField.YEAR);
 121  *       System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
 122  *                 dow, day, month, year);
 123  *   // Print today's date and the last day of the year for the Thai Buddhist Calendar.




  80  * See {@link java.time.chrono.ChronoLocalDate ChronoLocalDate}
  81  * for a full discussion of the issues.
  82  * </p>
  83  * <p>
  84  * Using non-ISO calendar systems in an application introduces significant extra complexity.
  85  * Ensure that the warnings and recommendations in {@code ChronoLocalDate} have been read before
  86  * working with the "chrono" interfaces.
  87  * </p>
  88  * <p>
  89  * The supported calendar systems includes:
  90  * </p>
  91  * <ul>
  92  * <li>{@link java.time.chrono.HijrahChronology Hijrah calendar}</li>
  93  * <li>{@link java.time.chrono.JapaneseChronology Japanese calendar}</li>
  94  * <li>{@link java.time.chrono.MinguoChronology Minguo calendar}</li>
  95  * <li>{@link java.time.chrono.ThaiBuddhistChronology Thai Buddhist calendar}</li>
  96  * </ul>
  97  *
  98  * <h2>Example</h2>
  99  * <p>
 100  * This example lists today's date for all of the available calendars.
 101  * </p>
 102  * <pre>
 103  *   // Enumerate the list of available calendars and print today's date for each.
 104  *       Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
 105  *       for (Chronology chrono : chronos) {
 106  *           ChronoLocalDate date = chrono.dateNow();
 107  *           System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
 108  *       }
 109  * </pre>
 110  *
 111  * <p>
 112  * This example creates and uses a date in a named non-ISO calendar system.
 113  * </p>
 114  * <pre>
 115  *   // Print the Thai Buddhist date
 116  *       ChronoLocalDate now1 = Chronology.of("ThaiBuddhist").dateNow();
 117  *       int day = now1.get(ChronoField.DAY_OF_MONTH);
 118  *       int dow = now1.get(ChronoField.DAY_OF_WEEK);
 119  *       int month = now1.get(ChronoField.MONTH_OF_YEAR);
 120  *       int year = now1.get(ChronoField.YEAR);
 121  *       System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
 122  *                 dow, day, month, year);
 123  *   // Print today's date and the last day of the year for the Thai Buddhist Calendar.


< prev index next >