Java example source code file (key_chronology.xml)
The key_chronology.xml Java example source code
<?xml version="1.0" encoding="ISO-8859-1"?> <document> <properties> <title>Java date and time API - Chronology <author>Stephen Colebourne </properties> <body> <section name="Chronology"> <p> A <i>chronology in Joda-Time is a pluggable calendar system. The JDK supports multiple calendar systems via subclasses of <code>Calendar. This is clunky, and in practice it is very difficult to write another calendar system. Joda-Time supports multiple calendar systems by designing a pluggable system. </p> <p> The default chronology in Joda-Time is <a href="cal_iso.html">ISO. This calendar system is the same as that used by business in the majority of the world today. The ISO system is unsuitable for historical work before 1583 as it applies the leap year rules from today back in time (it is a proleptic calendar). As a result, users requiring a more historically accurate calendar system are forced to think about their actual requirements, which we believe is a Good Thing. </p> <p> The actual calculations of the chronology are split between the <a href="apidocs/org/joda/time/Chronology.html">Chronology class itself and the field classes - <a href="apidocs/org/joda/time/DateTimeField.html">DateTimeField and <a href="apidocs/org/joda/time/DurationField.html">DurationField. Together, the subclasses of these three classes form the bulk of the code in the library. However, most users will never need to use or refer directly to the subclasses. Instead, most applications will simply obtain the chronology and use it as a singleton. </p> <p> The chronology class also supports the time zone functionality. This is applied to the underlying chronology via the decorator design pattern. The <a href="apidocs/org/joda/time/DateTimeZone.html">DateTimeZone class provides access to the zones via factories, and also supports a default zone concept. A full list of time zones can be found <a href="timezones.html">here. It is also possible to <a href="tz_update.html">update the zone data yourself. </p> <p> Internally, all the chronology, field and time zone classes are maintained as singletons. Thus there is an initial setup cost when using Joda-Time, but after that only the main API instance classes (DateTime, Interval, Period, etc.) have creation and garbage collector costs. </p> <p> Reference documentation is provided for each of the <a href="cal.html">8 calendar systems that Joda-Time includes. </p> </section> <section name="Using Chronology in Joda-Time"> <p> A Chronology is obtained and used in Joda-Time as a singleton: <source> DateTimeZone zone = DateTimeZone.forID("Europe/London"); Chronology coptic = CopticChronology.getInstance(zone); // current time with coptic chronology DateTime dt = new DateTime(coptic); int year = dt.getYear(); // gets the current coptic year int month = dt.getMonthOfYear(); // gets the current coptic month </source> </p> <subsection name="Nulls"> <p> A null chronology always refers to ISO chronology in the default zone. Thus, when a method is defined as taking a <code>Chronology, passing null in will be the same as passing in the ISO chronology in the default time zone. </p> </subsection> </section> </body> </document>
Other Java examples (source code examples)
Here is a short list of links related to this Java key_chronology.xml source code file:
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.