Class JulianCalendar

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CopticCalendar

public class JulianCalendar extends GregorianCalendar
Implementation of the proleptic Julian calendar. The Julian calendar was introduced by Julius Caesar in 46 BCE and was the predominant calendar in the Roman world and subsequently in the Western world until the Gregorian reform of 1582.

Key differences from the Gregorian calendar:

  • Leap year rule: every year divisible by 4 (no century exception)
  • Drifts approximately 1 day per 128 years relative to the tropical year
  • Uses astronomical year numbering (year 0 = 1 BCE)
* @version 2.0
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Field Details

    • EPOCH

      public static long EPOCH
      The Julian epoch: December 30, 1 BCE (proleptic Gregorian) = January 1, 1 CE (Julian).
  • Constructor Details

    • JulianCalendar

      public JulianCalendar(long rataDie)
      Creates a Julian calendar set to the specified Rata Die.
      Parameters:
      rataDie - the day number
    • JulianCalendar

      public JulianCalendar()
      Creates a Julian calendar set to the epoch (January 1, 1 CE).
    • JulianCalendar

      public JulianCalendar(AlternateCalendar calendar)
      Creates a Julian calendar from another calendar's date.
      Parameters:
      calendar - the source calendar
    • JulianCalendar

      public JulianCalendar(int year, int month, int day)
      Creates a Julian calendar set to the specified date.
      Parameters:
      year - the year (negative for BCE, using astronomical year numbering)
      month - the month (1-12)
      day - the day of month (1-31)
  • Method Details

    • recomputeRD

      protected void recomputeRD()
      Recomputes the Rata Die from the current year, month, and day fields.
      Overrides:
      recomputeRD in class GregorianCalendar
    • recomputeFromRD

      protected void recomputeFromRD()
      Recomputes the year, month, and day fields from the current Rata Die.
      Overrides:
      recomputeFromRD in class GregorianCalendar
    • set

      public void set(long rataDie)
      Sets this calendar to the specified Rata Die and recomputes the date fields.
      Overrides:
      set in class GregorianCalendar
      Parameters:
      rataDie - the new Rata Die value
    • isLeapYear

      public static boolean isLeapYear(int year)
      Determines if the specified year is a leap year in the Julian calendar. In the Julian calendar, every year divisible by 4 is a leap year.
      Parameters:
      year - the year to check (using astronomical year numbering)
      Returns:
      true if it's a leap year
    • getSuffix

      protected String getSuffix()
      Returns the era suffix for display.
      Overrides:
      getSuffix in class GregorianCalendar
      Returns:
      " C.E." for positive years, " B.C.E." for non-positive years
    • toString

      public String toString()
      Returns a string representation of this date.
      Overrides:
      toString in class GregorianCalendar
      Returns:
      formatted date string