Example usage for org.joda.time.chrono JulianChronology getInstance

List of usage examples for org.joda.time.chrono JulianChronology getInstance

Introduction

In this page you can find the example usage for org.joda.time.chrono JulianChronology getInstance.

Prototype

public static JulianChronology getInstance() 

Source Link

Document

Gets an instance of the JulianChronology in the default time zone.

Usage

From source file:com.helger.datetime.holiday.parser.impl.RelativeToEasterSundayParser.java

License:Apache License

/**
 * Returns the easter Sunday within the julian chronology.
 * //  w w w . j  a v a  2 s .co m
 * @param nYear
 *        The year to retrieve Julian Easter Sunday date
 * @return julian easter Sunday
 */
public static LocalDate getJulianEasterSunday(final int nYear) {
    int a, b, c, d, e;
    int x, nMonth, nDay;
    a = nYear % 4;
    b = nYear % 7;
    c = nYear % 19;
    d = (19 * c + 15) % 30;
    e = (2 * a + 4 * b - d + 34) % 7;
    x = d + e + 114;
    nMonth = x / 31;
    nDay = (x % 31) + 1;
    return new LocalDate(nYear, (nMonth == 3 ? DateTimeConstants.MARCH : DateTimeConstants.APRIL), nDay,
            JulianChronology.getInstance());
}

From source file:org.segrada.util.FlexibleDateParser.java

License:Apache License

/**
 * get chronology for type/*from w  w w .  j a va  2  s .c  o  m*/
 * @param type e.g. "G" or "J"
 * @return chronology for type
 */
protected Chronology getChronologyFromType(String type) {
    // fallback to default
    if (type == null)
        type = "G";

    if (type.equals("J"))
        return JulianChronology.getInstance();

    // default is gregorian/julian chronology
    return GJChronology.getInstance();
}