-
-
Notifications
You must be signed in to change notification settings - Fork 963
/
index.xml
202 lines (175 loc) · 8.5 KB
/
index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Java date and time API - Home</title>
<author>Stephen Colebourne</author>
<author>Al Major</author>
</properties>
<body>
<section name="Joda-Time - Java date and time API">
<p>
Joda-Time provides a quality replacement for the Java <em>date</em>
and <em>time</em> classes. The design allows for multiple <em>calendar</em>
systems, while still providing a simple API.
The 'default' calendar is the <a href="cal_iso.html">ISO8601</a> standard which
is used by XML. The Gregorian, Julian, Buddhist, Coptic, Ethiopic and Islamic systems
are also included, and we welcome further additions. Supporting classes include
time zone, duration, format and parsing.
</p>
<p>
As a flavour of Joda-Time, here's some example code:
<source>
public boolean isAfterPayDay(<a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a> datetime) {
if (datetime.getMonthOfYear() == 2) { // February is month 2!!
return datetime.getDayOfMonth() > 26;
}
return datetime.getDayOfMonth() > 28;
}
public <a href="apidocs/org/joda/time/Days.html"><b>Days</b></a> daysToNewYear(<a href="apidocs/org/joda/time/LocalDate.html"><b>LocalDate</b></a> fromDate) {
<a href="apidocs/org/joda/time/LocalDate.html"><b>LocalDate</b></a> newYear = fromDate.plusYears(1).withDayOfYear(1);
return <a href="apidocs/org/joda/time/Days.html"><b>Days</b></a>.daysBetween(fromDate, newYear);
}
public boolean isRentalOverdue(<a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a> datetimeRented) {
<a href="apidocs/org/joda/time/Period.html"><b>Period</b></a> rentalPeriod = new <a href="apidocs/org/joda/time/Period.html"><b>Period</b></a>().withDays(2).withHours(12);
return datetimeRented.plus(rentalPeriod).isBeforeNow();
}
public String getBirthMonthText(<a href="apidocs/org/joda/time/LocalDate.html"><b>LocalDate</b></a> dateOfBirth) {
return dateOfBirth.monthOfYear().getAsText(Locale.ENGLISH);
}
</source>
<!--
public boolean isDoubleShift(<a href="apidocs/org/joda/time/LocalTime.html"><b>LocalTime</b></a> startTime, <a href="apidocs/org/joda/time/LocalTime.html"><b>LocalTime</b></a> endTime) {
<a href="apidocs/org/joda/time/Hours.html"><b>Hours</b></a> hoursBetween = <a href="apidocs/org/joda/time/Hours.html"><b>Hours</b></a>.hoursBetween(time1, time2);
return hoursBetween.isGreaterThan(<a href="apidocs/org/joda/time/Hours.html"><b>Hours</b></a>.EIGHT);
}
public boolean isJoinedInLastThreeMonths(<a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a> datetimeJoined) {
<a href="apidocs/org/joda/time/Interval.html"><b>Interval</b></a> last3Months = new <a href="apidocs/org/joda/time/Interval.html"><b>Interval</b></a>(<a href="apidocs/org/joda/time/Months.html"><b>Months</b></a>.THREE, new <a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a>());
return last3Months.contains(datetimeJoined);
}
-->
Version 2.4 was released on 2014-07-27 -
<a href="download.html">Download now</a>
</p>
</section>
<section name="Why Joda-Time?">
<p>
Joda-Time has been created to radically change date and time handling in Java.
The JDK classes Date and Calendar are very badly designed, have had numerous bugs
and have odd performance effects.
Here are some of our reasons for developing and using Joda-Time:
<ul>
<li><b>Easy to Use</b>.
Calendar makes accessing 'normal' dates difficult, due to the lack of simple methods.
Joda-Time has straightforward <a href="field.html">field accessors</a> such as
<code>getYear()</code> or <code>getDayOfWeek()</code>.</li>
<li><b>Easy to Extend</b>.
The JDK supports multiple calendar systems via subclasses of <code>Calendar</code>.
This is clunky, and in practice it is very difficult to write another calendar system.
Joda-Time supports multiple calendar systems via a pluggable system based on the
<code>Chronology</code> class.</li>
<li><b>Comprehensive Feature Set</b>.
The library is intended to provide all the functionality that is required for date-time
calculations. It already provides out-of-the-box features, such as support for oddball
date formats, which are difficult to replicate with the JDK.</li>
<li><b>Up-to-date Time Zone calculations</b>.
The <a href="timezones.html">time zone implementation</a> is based on
the public <a href="http://www.iana.org/time-zones">tz database</a>, which is
updated several times a year. New Joda-Time releases incorporate all changes
made to this database. Should the changes be needed earlier,
<a href="tz_update.html">manually updating the zone data</a> is easy.</li>
<li><b>Calendar support</b>.
The library currently provides 8 calendar systems. More will be added in the future.</li>
<li><b>Easy interoperability</b>.
The library internally uses a millisecond instant which is identical to the JDK and similar
to other common time representations. This makes interoperability easy, and Joda-Time comes
with out-of-the-box JDK interoperability.</li>
<li><b>Better Performance Characteristics</b>.
Calendar has strange performance characteristics as it recalculates fields at unexpected moments.
Joda-Time does only the minimal calculation for the field that is being accessed.</li>
<li><b>Good Test Coverage</b>.
Joda-Time has a comprehensive set of developer tests, providing assurance of the library's quality.</li>
<li><b>Complete Documentation</b>.
There is a full <a href="userguide.html">User Guide</a> which provides an overview and covers
common usage scenarios. The <a href="apidocs/index.html">javadoc</a>
is extremely detailed and covers the rest of the API.</li>
<li><b>Maturity</b>.
The library has been under active development since 2002.
Although it continues to be improved with the addition of new features and
bug-fixes, it is a mature and reliable code base.
A number of <a href="related.html">related projects</a> are now available.</li>
<li><b>Open Source</b>.
Joda-Time is licenced under the business friendly <a href="license.html">Apache License Version 2.0</a>.</li>
</ul>
</p>
</section>
<section name="Documentation">
<p>
Various documentation is available:
<ul>
<li>Two user guides - <a href="quickstart.html">quick</a> and <a href="userguide.html">full</a></li>
<li>The key concepts and chronology documents in the left navigation area</li>
<li>The <a href="apidocs/index.html">Javadoc</a></li>
<li>Information on <a href="installation.html">downloading and installing</a> Joda-Time including release notes</li>
<li>The <a href="faq.html">FAQ</a> list</li>
<li>The <a href="https://github.com/JodaOrg/joda-time">GitHub</a> source repository</li>
</ul>
</p>
</section>
<section name="Releases">
<p>
<a href="download.html">Release 2.4</a>
is the current latest release.
This release is an evolution of the 1.x codebase, not a major rewrite.
It is considered stable and worthy of the 2.x tag.
</p>
<p>
Version 2.4 is a bugfix release compatible with version 2.3.
See the <a href="upgradeto240.html">upgrade notes</a> for full details.
</p>
<p>
Version 2.x is almost completely source and binary compatible with version 1.x.
Key changes include the use of JDK 1.5 or later, generics, and the removal of some (but not all)
deprecated methods. See the <a href="upgradeto200.html">upgrade notes</a> for full details
including information on the corner cases that are not compatible.
</p>
<p>
We will support the 2.x product line using standard Java mechanisms.
The main public API will remain backwards compatible for both source and binary in the 2.x stream.
The version number will change to 3.0 to indicate a significant change in compatibility.
</p>
<p>
Available in <a href="http://search.maven.org/#artifactdetails|joda-time|joda-time|2.4|jar">Maven Central</a>.
</p>
<p>
<a href="https://sourceforge.net/projects/joda-time/files/joda-time/1.6.2/">Release 1.6.2</a>
is the last v1.x release.
It is compatible with JDK 1.4.
Given that v2.x is essentially compatible with v1.6.2, there are no current plans for further
releases in the v1.x product line.
</p>
</section>
<section name="Support">
<p>
Support on bugs, library usage or enhancement requests is available on a best efforts basis.
</p>
<p>
To suggest enhancements or contribute, please <a href="https://github.com/JodaOrg/joda-time">fork the source code</a> on GitHub.
Alternatively, use GitHub <a href="https://github.com/JodaOrg/joda-time/issues">issues</a>.
</p>
<p>
The older mechanisms of the joda-interest <a href="mail-lists.html">mailing list</a>
and the joda-time <a href="http://sourceforge.net/projects/joda-time/forums/forum/337835">forums</a>
do still exist, but are deprecated.
</p>
<p>
<br />
</p>
<p>
<br />
</p>
<p>
<br />
</p>
</section>
</body>
</document>