java - Joda api not return proper islamic date -


i converting gregorian dates islamic dates. setting leap year pattern indian leap year not working.

i make loop , gregorian date takes current month , count days , convert islamic date. what want

here code

        for(int i=0;i<maxday;i++)         {             eng.add(string.valueof(i+1));             datetime dtiso=new datetime(currenty,currentmonth+1,i+1,0,0);             datetimezone asia= datetimezone.forid("asia/riyadh");              datetime dtislamic = dtiso.withchronology(                     islamicchronology.getinstance(                               asia,                                islamicchronology.leap_year_indian));             string islamicdatearr="";             split=dtislamic.tostring().split("t");             split=split[0].split("-");             if(i==0 || integer.parseint(split[2])==1)             {                 isl.add(string.valueof(split[2]+" "+islamicmonths[integer.parseint(split[1])-1]));                 continue;             }             isl.add(string.valueof(split[2]));         } 

your code seems correct.

since told me have tried every of 4 leap year patterns of joda-time without success feeling there might bug or missing feature because among supported leap year patterns there should pair of patterns different 1 day (and observe 1 day difference).

other people have submitted bug issues. see here:

issue 163

issue 107

as can see hard convince project leader solve problem you. maybe right when saying joda-time has not bug, not complete.

keep in mind according r.h. van gent calculated islamic calendar algorithm knows @ least 8 instead of 4 variants because there 4 intercalary schemes , (for each scheme) 2 variations depending on precise start of islamic epoch (thursday versus friday epoch). joda-time not supporting variants.

what alternatives joda-time?

a) java-8 , backport threeten-bp (for java-6+7) support table-driven umalqura-calendar of saudi-arabia (sighting-based). not sure if solves problem (if not might supply hand-written file containing table data relevant - lot of work). note both libraries don't support algorithm-based islamic calendars.

b) people have written own home-grown workarounds. have found hijri converter via google. no idea if works you.

c) ibm offers hijri calendar in icu-project. offers different leap year patterns joda-time. maybe helps.

side note: can see current java-support hijri calendars not satisfying. why decided set new implementation in own library time4j. scheduled maybe 2-3 months later in autumn 2015.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -