Skip to Main Content
Java Cookbook
book

Java Cookbook

by Ian F. Darwin
June 2001
Intermediate to advanced content levelIntermediate to advanced
888 pages
21h 1m
English
O'Reilly Media, Inc.
Content preview from Java Cookbook

Representing Dates in Other Epochs

Problem

You need to deal with dates in a form other than the Gregorian Calendar used in the western world.

Solution

Visit the IBM alphaWorks web site.

Discussion

As of Java 2, the only non-abstract Calendar subclass is the GregorianCalendar, as mentioned previously. However, others do exist. Check out the IBM alphaWorks web site (http://alphaworks.ibm.com), which has a large collection of freely available Java software (mostly without source code, alas). Search for “calendar”, and you’ll find a set of calendars -- Hebrew, Islamic, Buddhist, Japanese, and even an Astronomical Calendar class -- that covers most of the rest of the world.

These work in a similar fashion to the standard GregorianCalendar class, but have constants for month names and other information relevant to each particular calendar.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Cloud-Native Java Development with MicroProfile

Practical Cloud-Native Java Development with MicroProfile

Emily Jiang, Andrew McCright, John Alcorn, David Chan, Alasdair Nottingham
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti

Publisher Resources

ISBN: 0596001703Supplemental ContentCatalog PageErrata