PageSourceSearch

https://www.joda.org/joda-time/

html joda.org collected 2026-10-01 10:15:17 UTC 22,429 bytes, 431 lines download raw bytes

1
2<!DOCTYPE html>
3<!--
4 Generated by Apache Maven Doxia at 2026-10-01
5 Rendered using Reflow Maven Skin 1.2 (http://andriusvelykis.github.io/reflow-maven-skin)
6-->
7<html  xml:lang="en" lang="en">
8
9	<head>
10		<meta charset="UTF-8" />
11		<title>Joda-Time - Home</title>
12		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13		<meta name="description" content="" />
14		<meta http-equiv="content-language" content="en" />
15
16		<link href="//netdna.bootstrapcdn.com/bootswatch/2.3.2/cosmo/bootstrap.min.css" rel="stylesheet" />
17		<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" rel="stylesheet" />
18		<link href="./css/bootswatch.css" rel="stylesheet" />
19		<link href="./css/reflow-skin.css" rel="stylesheet" />
20
21		<link href="//yandex.st/highlightjs/7.5/styles/github.min.css" rel="stylesheet" />
22
23
24		<link href="./css/site.css" rel="stylesheet" />
25		<link href="./css/print.css" rel="stylesheet" media="print" />
26
27		<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
28		<!--[if lt IE 9]>
29			
29<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
29
30		<![endif]-->
31
32
33<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
34        <link rel="author" href="https://plus.google.com/113137868744510231215"/>
35
36		<!-- Google Analytics -->
37		
37<script type="text/javascript">
38
39			var _gaq = _gaq || [];
40			_gaq.push(['_setAccount', 'UA-1425975-4']);
41			_gaq.push(['_trackPageview']);
42
43			(function() {
44				var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
45				ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
46				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
47			})();
48
49		</script>
49
50		</head>
51
52	<body class="page-index project-joda-time" data-spy="scroll" data-offset="60" data-target="#toc-scroll-target">
53
54		<div class="navbar navbar-fixed-top">
55			<div class="navbar-inner">
56				<div class="container">
57					<a class="btn btn-navbar" data-toggle="collapse" data-target="#top-nav-collapse">
58						<span class="icon-bar"></span>
59						<span class="icon-bar"></span>
60						<span class="icon-bar"></span>
61					</a>
62					<a class="brand" href="index.html">Joda-Time</a>
63					<div class="nav-collapse collapse" id="top-nav-collapse">
64						<ul class="nav pull-right">
65							<li class="dropdown active">
66								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
67								<ul class="dropdown-menu">
68									<li class="active"><a href="" title="Home">Home</a></li>
69									<li ><a href="quickstart.html" title="Quick start guide">Quick start guide</a></li>
70									<li ><a href="userguide.html" title="User guide">User guide</a></li>
71									<li class="dropdown-submenu ">
72										<a href="key.html" title="Key concepts">Key concepts</a>
73										<ul class="dropdown-menu">
74											<li ><a href="key_instant.html" title="Instant">Instant</a></li>
75											<li ><a href="key_partial.html" title="Partial">Partial</a></li>
76											<li ><a href="key_interval.html" title="Interval">Interval</a></li>
77											<li ><a href="key_duration.html" title="Duration">Duration</a></li>
78											<li ><a href="key_period.html" title="Period">Period</a></li>
79											<li ><a href="key_chronology.html" title="Chronology">Chronology</a></li>
80											<li ><a href="key_format.html" title="Formatting">Formatting</a></li>
81											<li ><a href="tz_update.html" title="Time zone update">Time zone update</a></li>
82										</ul>
83									</li>
84									<li class="dropdown-submenu ">
85										<a href="cal.html" title="Chronologies">Chronologies</a>
86										<ul class="dropdown-menu">
87											<li ><a href="cal_iso.html" title="ISO8601">ISO8601</a></li>
88											<li ><a href="cal_buddhist.html" title="Buddhist">Buddhist</a></li>
89											<li ><a href="cal_coptic.html" title="Coptic">Coptic</a></li>
90											<li ><a href="cal_ethiopic.html" title="Ethiopic">Ethiopic</a></li>
91											<li ><a href="cal_gregorian.html" title="Gregorian">Gregorian</a></li>
92											<li ><a href="cal_gj.html" title="GregorianJulian">GregorianJulian</a></li>
93											<li ><a href="cal_islamic.html" title="Islamic">Islamic</a></li>
94											<li ><a href="cal_julian.html" title="Julian">Julian</a></li>
95										</ul>
96									</li>
97									<li ><a href="faq.html" title="FAQ">FAQ</a></li>
98									<li ><a href="apidocs/index.html" title="Javadoc">Javadoc</a></li>
99									<li ><a href="licenses.html" title="License">License</a></li>
100								</ul>
101							</li>
102							<li class="dropdown">
103								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Releases <b class="caret"></b></a>
104								<ul class="dropdown-menu">
105									<li ><a href="changes-report.html" title="Release notes">Release notes</a></li>
106									<li ><a href="installation.html" title="Old release notes">Old release notes</a></li>
107									<li ><a href="dependency-info.html" title="Dependency info">Dependency info</a></li>
108									<li ><a href="security.html" title="Security">Security</a></li>
109									<li ><a href="download.html" title="Download">Download</a></li>
110								</ul>
111							</li>
112							<li class="dropdown">
113								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Development <b class="caret"></b></a>
114								<ul class="dropdown-menu">
115									<li ><a href="https://github.com/JodaOrg/joda-time" title="GitHub" class="externalLink">GitHub</a></li>
116									<li ><a href="https://github.com/JodaOrg/joda-time/issues" title="Bugs/Issues" class="externalLink">Bugs/Issues</a></li>
117									<li ><a href="surefire-report.html" title="Test results">Test results</a></li>
118								</ul>
119							</li>
120							<li class="dropdown">
121								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Related <b class="caret"></b></a>
122								<ul class="dropdown-menu">
123									<li ><a href="related.html" title="Related projects">Related projects</a></li>
124									<li ><a href="../joda-time-jsptags/" title="JSP tags">JSP tags</a></li>
125									<li ><a href="../joda-time-hibernate/" title="Hibernate">Hibernate</a></li>
126									<li ><a href="../joda-time-i18n/" title="I18N">I18N</a></li>
127								</ul>
128							</li>
129							<li class="dropdown">
130								<a href="#" class="dropdown-toggle" data-toggle="dropdown">Joda <b class="caret"></b></a>
131								<ul class="dropdown-menu">
132									<li ><a href="../" title="Home">Home</a></li>
133									<li ><a href="../joda-beans/" title="Beans">Beans</a></li>
134									<li ><a href="../joda-convert/" title="Convert">Convert</a></li>
135									<li ><a href="../joda-money/" title="Money">Money</a></li>
136								</ul>
137							</li>
138							<li class="dropdown">
139								<a href="#" class="dropdown-toggle" data-toggle="dropdown">For Enterprise <b class="caret"></b></a>
140								<ul class="dropdown-menu">
141									<li ><a href="enterprise.html" title="Tidelift">Tidelift</a></li>
142								</ul>
143							</li>
144						</ul>
145					</div><!--/.nav-collapse -->
146				</div>
147			</div>
148		</div>
149
150	<div class="container">
151
152	<!-- Masthead
153	================================================== -->
154
155	<header>
156	</header>
157
158	<div class="main-body">
159	<div class="row columns columns3">
160		<div class="span4">
161			<h2 id="About"><i></i> About</h2>
162<p>Joda-Time provides a quality replacement for the Java date and time classes.</p>
163<p>Joda-Time is the <i>de facto</i> standard date and time library for Java prior to Java SE 8. Users are now asked to migrate to <code>java.time</code> (JSR-310).</p>
164<p>Joda-Time is licensed under the business-friendly <a href="licenses.html">Apache 2.0 licence</a>.</p>
165<section>    
166</section>
167		</div>
168		<div class="span4">
169			<h2 id="Features"><i></i> Features</h2>
170<p>A selection of key features:</p>
171<ul> 
172 <li><code>LocalDate</code> - date without time</li> 
173 <li><code>LocalTime</code> - time without date</li> 
174 <li><code>Instant</code> - an instantaneous point on the time-line</li> 
175 <li><code>DateTime</code> - full date and time with time-zone</li> 
176 <li><code>DateTimeZone</code> - a better time-zone</li> 
177 <li><code>Duration</code> and <code>Period</code> - amounts of time</li> 
178 <li><code>Interval</code> - the time between two instants</li> 
179 <li>A comprehensive and flexible formatter-parser</li> 
180</ul>
181<section>    
182</section>
183		</div>
184		<div class="span4">
185			<h2 id="Documentation"><i></i> Documentation</h2>
186<p>Various documentation is available:</p>
187<ul> 
188 <li>The <a href="quickstart.html">getting started</a> guide</li> 
189 <li>The helpful <a href="userguide.html">user guide</a></li> 
190 <li>The <a href="key.html">key concepts</a> and <a href="cal.html">chronology</a> guides</li> 
191 <li>The <a href="apidocs/index.html">Javadoc</a></li> 
192 <li>The list of <a href="faq.html">FAQ</a>s.</li> 
193 <li>The <a href="changes-report.html">change notes</a> for each release</li> 
194 <li>The <a href="security.html">security</a> issues page</li> 
195 <li>The <a class="externalLink" href="https://github.com/JodaOrg/joda-time">GitHub</a> source repository</li> 
196</ul>
197		</div>
198	</div>
199	<div class="row">
200	</div>
201	<div class="row columns columns2">
202		<div class="span6">
203			<h2 id="Why_Joda_Time.3F"><i></i> Why Joda Time?</h2>
204<p>The standard date and time classes prior to Java SE 8 are poor. By tackling this problem head-on, Joda-Time became the de facto standard date and time library for Java prior to Java SE 8. <b>Note that from Java SE 8 onwards, users are asked to migrate to <code>java.time</code> (JSR-310) - a core part of the JDK which replaces this project.</b></p>
205<p>The design allows for multiple calendar systems, while still providing a simple API. The “default” calendar is the <a href="cal_iso.html">ISO8601</a> standard which is used by many other standards. The Gregorian, Julian, Buddhist, Coptic, Ethiopic and Islamic calendar systems are also included. Supporting classes include time zone, duration, format and parsing.</p>
206<p>As a flavour of Joda-Time, here's some example code:</p>
207<div class="source"> 
208 <div class="source"> 
209  <pre>
210public boolean isAfterPayDay(<a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a> datetime) {
211  if (datetime.getMonthOfYear() == 2) {   // February is month 2!!
212    return datetime.getDayOfMonth() &gt; 26;
213  }
214  return datetime.getDayOfMonth() &gt; 28;
215}
216</pre> 
217 </div> 
218 <div class="source"> 
219  <pre>
220public <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) {
221  <a href="apidocs/org/joda/time/LocalDate.html"><b>LocalDate</b></a> newYear = fromDate.plusYears(1).withDayOfYear(1);
222  return <a href="apidocs/org/joda/time/Days.html"><b>Days</b></a>.daysBetween(fromDate, newYear);
223}
224</pre> 
225 </div> 
226 <div class="source"> 
227  <pre>
228public boolean isRentalOverdue(<a href="apidocs/org/joda/time/DateTime.html"><b>DateTime</b></a> datetimeRented) {
229  <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);
230  return datetimeRented.plus(rentalPeriod).isBeforeNow();
231}
232</pre> 
233 </div> 
234 <div class="source"> 
235  <pre>
236public String getBirthMonthText(<a href="apidocs/org/joda/time/LocalDate.html"><b>LocalDate</b></a> dateOfBirth) {
237  return dateOfBirth.monthOfYear().getAsText(Locale.ENGLISH);
238}
239</pre> 
240 </div> 
241</div>
242<section>    
243</section>
244		</div>
245		<div class="span6">
246			<h2 id="Rationale"><i></i> Rationale</h2>
247<p>Here are some of our reasons for developing and using Joda-Time:</p>
248<ul> 
249 <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> 
250 <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> 
251 <li><b>
251Comprehensive 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> 
252 <li><b>Up-to-date Time Zone calculations</b>. The <a href="timezones.html">time zone implementation</a> is based on <a class="externalLink" href="https://github.com/JodaOrg/global-tz">global-tz</a>, which is a fork of the original data provided by IANA. It 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> 
253 <li><b>Calendar support</b>. The library provides <a href="cal.html">8 calendar systems</a>.</li> 
254 <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> 
255 <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> 
256 <li><b>Good Test Coverage</b>. Joda-Time has a comprehensive set of developer tests, providing assurance of the library's quality.</li> 
257 <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> 
258 <li><b>Maturity</b>. The library has been under active development since 2002. It is a mature and reliable code base. A number of <a href="related.html">related projects</a> are now available.</li> 
259 <li><b>Open Source</b>. Joda-Time is licenced under the business friendly <a href="licenses.html">Apache License Version 2.0</a>.</li> 
260</ul>
261		</div>
262	</div>
263	<div class="row">
264	</div>
265	<div class="row">
266		<div class="span8">
267			<div class="body-content">
268				<section> 
269 <h2 id="Releases"><i></i> Releases</h2> 
270 <p><a href="download.html">Release 2.15.0</a> is the current latest release. This release is considered stable and worthy of the 2.x tag. See the <a href="changes-report.html">change notes</a> for full details.</p> 
271 <p>Joda-Time requires Java SE 5 or later and has <a href="dependencies.html">no dependencies</a>. There is a <i>compile-time</i> dependency on <a href="/joda-convert/">Joda-Convert</a>, but this is not required at runtime thanks to the magic of annotations.</p> 
272 <p>Available in <a class="externalLink" href="https://search.maven.org/search?q=g:jod
272a-time%20AND%20a:joda-time&amp;core=gav">Maven Central</a>.</p> 
273 <div> 
274  <pre><code class="language-xml">&lt;dependency&gt;
275  &lt;groupId&gt;joda-time&lt;/groupId&gt;
276  &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
277  &lt;version&gt;2.15.0&lt;/version&gt;
278&lt;/dependency&gt;
279</code></pre> 
280 </div> 
281 <p>The 2.x product line will be supported 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> 
282 <p>Joda-Time v2.x is an evolution of the 1.x codebase, not a major rewrite. It is almost completely source and binary compatible with version 1.x. Key changes included the use of Java SE 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 when upgrading from 1.x including information on the corner cases that are not compatible. The ancient release <a class="externalLink" href="https://sourceforge.net/projects/joda-time/files/joda-time/1.6.2/">1.6.2</a> was the last release to support Java SE 4 and the last v1.x release.</p> 
283 <p>Java module name: <code>org.joda.time</code>.</p>    
284</section>
285			</div>
286		</div>
287		<div class="span4">
288			<div class="well sidebar">
289	<h3 id="For_Enterprise">For Enterprise</h3>
290<p><a class="externalLink" href="https://tidelift.com/subscription/pkg/maven-joda-time-joda-time?utm_source=maven-joda-time-joda-time&amp;utm_medium=referral&amp;utm_campaign=enterprise">Available as part of the Tidelift Subscription</a>.</p>
291<p>Joda and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.</p>
292<p>If you want the flexibility of open source and the confidence of commercial-grade software, this is for you. <a class="externalLink" href="https://tidelift.com/subscription/pkg/maven-joda-time-joda-time?utm_source=maven-joda-time-joda-time&amp;utm_medium=referral&amp;utm_campaign=enterprise">Learn more</a>.</p>
293<section>      
294</section>
295	<h3 id="Support">Support</h3>
296<p>Please use <a class="externalLink" href="https://stackoverflow.com/questions/tagged/jodatime">Stack Overflow</a> for general usage questions. GitHub <a class="externalLink" href="https://github.com/JodaOrg/joda-time/issues">issues</a> and <a class="externalLink" href="https://github.com/JodaOrg/joda-time/pulls">pull requests</a> should be used when you want to help advance the project.</p>
297<p>Any donations to support the project are accepted via <a class="externalLink" href="https://opencollective.com/joda">OpenCollective</a>.</p>
298<p>Note that Joda-Time is considered to be a largely “finished” project. No major enhancements are planned. If using Java SE 8, please migrate to <code>java.time</code> (JSR-310).</p>
299<p>To report a security vulnerability, please use the <a class="externalLink" href="https://tidelift.com/security">Tidelift security contact</a>. Tidelift will coordinate the fix and disclosure.</p>
300			</div>
301		</div>
302	</div>
303	</div>
304
305	</div><!-- /container -->
306
307	<!-- Footer
308	================================================== -->
309	<footer class="well">
310		<div class="container">
311			<div class="row">
312				<div class="span2 bottom-nav">
313					<ul class="nav nav-list">
314						<li class="nav-header">Information</li>
315						<li class="active">
316							<a href="#" title="Home">Home</a>
317						</li>
318						<li >
319							<a href="quickstart.html" title="Quick start guide">Quick start guide</a>
320						</li>
321						<li >
322							<a href="userguide.html" title="User guide">User guide</a>
323						</li>
324						<li >
325							<a href="faq.html" title="FAQ">FAQ</a>
326						</li>
327						<li >
328							<a href="related.html" title="Related projects">Related projects</a>
329						</li>
330						<li >
331							<a href="apidocs/index.html" title="Javadoc">Javadoc</a>
332						</li>
333						<li >
334							<a href="licenses.html" title="License">License</a>
335						</li>
336						<li >
337							<a href="key.html" title="Key concepts">Key concepts</a>
338						</li>
339						<li >
340							<a href="cal.html" title="Chronologies">Chronologies</a>
341						</li>
342					</ul>
343				</div>
344				<div class="span2 bottom-nav">
345					<ul class="nav nav-list">
346						<li class="nav-header">Releases</li>
347						<li >
348							<a href="changes-report.html" title="Release notes">Release notes</a>
349						</li>
350						<li >
351							<a href="installation.html" title="Old release notes">Old release notes</a>
352						</li>
353						<li >
354							<a href="dependency-info.html" title="Dependency info">Dependency info</a>
355						</li>
356						<li >
357							<a href="security.html" title="Security">Security</a>
358						</li>
359						<li >
360							<a href="download.html" title="Download">Download</a>
361						</li>
362						<li class="nav-header">Related</li>
363						<li >
364							<a href="related.html" title="Related projects">Related projects</a>
365						</li>
366						<li >
367							<a href="../joda-time-jsptags/" title="JSP tags">JSP tags</a>
368						</li>
369						<li >
370							<a href="../joda-time-hibernate/" title="Hibernate">Hibernate</a>
371						</li>
372						<li >
373							<a href="../joda-time-i18n/" title="I18N">I18N</a>
374						</li>
375					</ul>
376				</div>
377				<div class="span2 bottom-nav">
378					<ul class="nav nav-list">
379						<li class="nav-header">Development</li>
380						<li >
381							<a href="https://github.com/JodaOrg/joda-time" title="GitHub" class="externalLink">GitHub</a>
382						</li>
383						<li >
384							<a href="https://github.com/JodaOrg/joda-time/issues" title="Bugs/Issues" class="externalLink">Bugs/Issues</a>
385						</li>
386						<li >
387							<a href="surefire-report.html" title="Test results">Test results</a>
388						</li>
389					</ul>
390				</div>
391				<div class="span3 bottom-nav">
392					<ul class="nav nav-list">
393						<li class="nav-header">Reports</li>
394						<li >
395							<a href="project-info.html" title="Project Information">Project Information <i class="icon-chevron-right"></i></a>
396						</li>
397						<li >
398							<a href="project-reports.html" title="Project Reports">Project Reports <i class="icon-chevron-right"></i></a>
399						</li>
400					</ul>
401				</div>
402				<div class="span3 bottom-description">
403					<blockquote>Basic date-time types for Java</blockquote>
404				</div>
405			</div>
406		</div>
407	</footer>
408
409	<div class="container subfooter">
410		<div class="row">
411			<div class="span12">
412				<p class="pull-right"><a href="#">Back to top</a></p>
413				<p class="copyright">Copyright &copy;2002-2026 <a href="https://www.joda.org">Joda.org</a>. All Rights Reserved.</p>
414				<p class="version-date"><span class="projectVersion">Version: 2.15.0. </span><span class="publishDate">Last Published: 2026-10-01. </span></p>
415				<p><a href="https://github.com/JodaOrg/reflow-maven-skin" title="Reflow Maven skin">Reflow Maven skin</a>.</p>
416			</div>
417		</div>
418	</div>
419
420	<!-- Le javascript
421	================================================== -->
422	<!-- Placed at the end of the document so the pages load faster -->
423	
423<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
423
424
425	
425<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
425
426	
426<script src="//yandex.st/highlightjs/7.5/highlight.min.js"></script>
426
427
428	
428<script src="./js/reflow-skin.js"></script>
428
429
430	</body>
431</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.