Example usage for org.joda.time.chrono IslamicChronology getInstanceUTC

List of usage examples for org.joda.time.chrono IslamicChronology getInstanceUTC

Introduction

In this page you can find the example usage for org.joda.time.chrono IslamicChronology getInstanceUTC.

Prototype

public static IslamicChronology getInstanceUTC() 

Source Link

Document

Gets an instance of the IslamicChronology.

Usage

From source file:Classes.HijriTime.java

License:Open Source License

public String getHijriTime() {////get final translated hijri date
    this.dayFormatter = new DecimalFormat("00");
    this.yearFormatter = new DecimalFormat("0000");

    Chronology iSOChronology = ISOChronology.getInstanceUTC();//get ISOChronology instance
    Chronology islamicChronology = IslamicChronology.getInstanceUTC();//get IslamicChronology instance

    LocalDate localDateISOChronology = new LocalDate(year, month, day, iSOChronology);//get local date
    LocalDate HijriDate = new LocalDate(localDateISOChronology.toDate(), islamicChronology);//get hijri date

    return hijriDaysNames[calendar.get(Calendar.DAY_OF_WEEK)] + " "
            + dayFormatter.format(HijriDate.getDayOfMonth()) + " "
            + hijriMonthsNames[HijriDate.getMonthOfYear()] + " " + yearFormatter.format(HijriDate.getYear());
}

From source file:com.helger.datetime.holiday.CalendarUtil.java

License:Apache License

/**
 * Returns a set of gregorian dates within a gregorian year which equal the
 * islamic month and day. Because the islamic year is about 11 days shorter
 * than the gregorian there may be more than one occurrence of an islamic date
 * in an gregorian year. i.e.: In the gregorian year 2008 there were two 1/1.
 * They occurred on 1/10 and 12/29./*from   w  ww  . j  av a  2 s.c  o  m*/
 *
 * @param nGregorianYear
 *        Year to convert
 * @param nIslamicMonth
 *        Month to convert
 * @param nIslamicDay
 *        Day to convert
 * @return List of gregorian dates for the islamic month/day.
 */
public static Set<LocalDate> getIslamicHolidaysInGregorianYear(final int nGregorianYear,
        final int nIslamicMonth, final int nIslamicDay) {
    return getDatesFromChronologyWithinGregorianYear(nIslamicMonth, nIslamicDay, nGregorianYear,
            IslamicChronology.getInstanceUTC());
}