Get Month Name of java.time.chrono.HijrahDate instance

hijri, java-8, umalquracalendar

Solution

The date does not contain information about the names of the months or days. To get that you need a formatter:

System.out.println(DateTimeFormatter.ofPattern("MMMM").format(hd));

prints `Safar`.

Problem

``` HijrahDate hd=HijrahChronology.INSTANCE.date(LocalDate.of(2014,11, 25)); ``` If we have `HijrahDate` Instance , it is expected to have a method in `UmalquraCalendar API` that shows the name of month : i inspect properties of this instance using groovy API : ``` ['era':AH, 'class':class java.time.chrono.HijrahDate, 'prolepticMonth':17233, 'eraValue':1, 'dayOfWeek':2, 'leapYear':false, 'chronology':Hijrah-umalqura, 'dayOfYear':32] ``` However we don't find the month name which must be one of the following list items : - Muḥarram (محرم meaning "forbidden"), so called because battle was forbidden (haram) during this month. Muharram includes the Day of Ashura. - Ṣafar (صفر meaning "void"), supposedly named thus because pagan Arab houses were empty this time of year while their occupants gathered food. Rabīʿ I (Rabīʿ al-Awwal, ربيع الأوّل) meaning "the first spring". Rabīʿ II (Rabīʿ ath-Thānī ربيع الثاني or Rabīʿ al-Ākhir ربيع الآخ ..................... ............ so on SEE Thus , since there is no attribute save month's name , it is expwcted to have a method retrieve this info ? What's this method?

Original source