3

i found converting gregorian to hijri by joda time in java, but i want to convert specific Hijri date to Gregorian using joda-time .

also if there any way may help.

  • Do you speak about `LocalDate`? Or about `DateTime` and its method `withChronology()`? If you only have a simple date without time or offset then conversion to `DateTime`, applying `withChronology()` and then converting back might help. – Meno Hochschild Nov 07 '14 at 13:31
  • it's very simple, i want to pass Hijri date (yer,month and day) then i want opposite Gregorian (converting the date from hijri to Gregorian) – Abdullah Al Dokhi Nov 07 '14 at 19:37

1 Answers1

6

This works:

    Chronology iso = ISOChronology.getInstanceUTC();
    Chronology hijri = IslamicChronology.getInstanceUTC();
    DateTime dtHijri = new DateTime(1436,02,02,22,22,hijri);

    DateTime dtIso = new DateTime(dtHijri, iso);
ampofila
  • 655
  • 2
  • 13
  • 28