How to get week of year for Jewish calendar

I try to find the week of the year for Jewish to use it in a global app, which provides general services about the international calendar.


You might try my lib Time4J which offers a Jewish/Hebrew calendar and use following code:

HebrewCalendar hebcal = HebrewCalendar.nowInSystemTime();
int weekOfYear = hebcal.getInt(HebrewCalendar.WEEK_OF_YEAR);

It uses the default week model/definition in Israel which starts the week on Sunday (after Sabbat).

About interoperability with java.time:

LocalDate gregorian = hebcal.transform(PlainDate.class).toTemporalAccessor();
HebrewCalendar jewish = PlainDate.from(gregorian).transform(HebrewCalendar.class);

Leave a Reply

Your email address will not be published. Required fields are marked *