Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Joda-Time

Joda-Time Joda-Time aims to provide a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still providing a simple API. The \\\\\'default\\\\\' calendar is the ISO8601 standard which is used by X

Tutorial Details:

The decision to create a cleanroom date implementation to replace Java\\\\\'s is based on the flaws in the JDK code. Date should have been immutable, like String, instead it is mutable and has many deprecated methods. Calendar makes accessing \\\\\'normal\\\\\' dates difficult, due to the lack of simple methods. It also has some strange performance characteristics as it recalculates fields at unexpected moments.

Using a Joda date

DateTime dt = new DateTime();
int year = dt.getYear();
String monthText = dt.monthOfYear().getAsText(Locale.ENGLISH);
String monthInFrench = dt.monthOfYear().getAsText(Locale.FRENCH);
String dateAsISO8601Format = dt.toString();

Current interfaces and implementations include:

Instant
DateTime
DateMidnight
YearMonthDay
TimeOfDay
Duration
Period
Interval
Chronology
DateTimeZone
...plus formatting and parsing


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Joda-Time

View Tutorial:
Joda-Time

Related Tutorials:

Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.