Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Java support Julian calendar?

Tags:

java

calendar

Oracle docs http://docs.oracle.com/javase/6/docs/technotes/guides/intl/calendar.doc.html states that Java supports 3 calendar systems: Gregorian, Japanese Imperial and Thai Buddhist. Does Java support Julian calendar?

like image 753
Evgeniy Dorofeev Avatar asked Nov 26 '12 17:11

Evgeniy Dorofeev


2 Answers

Yes, it does.

From the doc of GregorianCalendar:

GregorianCalendar is a hybrid calendar that supports both the Julian and Gregorian calendar systems with the support of a single discontinuity, which corresponds by default to the Gregorian date when the Gregorian calendar was instituted (October 15, 1582 in some countries, later in others). The cutover date may be changed by the caller by calling setGregorianChange().

Use setGregorianChange to change it.

public void setGregorianChange(Date date) Sets the GregorianCalendar change date. This is the point when the switch from Julian dates to Gregorian dates occurred. Default is October 15, 1582 (Gregorian). Previous to this, dates will be in the Julian calendar. To obtain a pure Julian calendar, set the change date to Date(Long.MAX_VALUE). To obtain a pure Gregorian calendar, set the change date to Date(Long.MIN_VALUE).

like image 175
Baptiste Wicht Avatar answered Oct 23 '22 18:10

Baptiste Wicht


The standard Calendar class might not, but the Joda Time library does.

like image 42
Gili Avatar answered Oct 23 '22 19:10

Gili