### Expected Output for GeoLocation Example Source: https://context7.com/kosherjava/zmanim/llms.txt This is the expected console output when running the GeoLocation setup code. ```text Location: Lakewood, NJ Latitude: 40.096 Longitude: -74.222 Elevation: 0.0 meters Timezone: America/New_York Distance to Jerusalem: 9144.23 km Initial bearing to Jerusalem: 53.47° ``` -------------------------------- ### Calculate Extended Zmanim with ComplexZmanimCalendar Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates how to initialize ComplexZmanimCalendar and calculate various zmanim based on different rabbinical opinions. Requires GeoLocation and TimeZone setup. ```java import com.kosherjava.zmanim.ComplexZmanimCalendar; import com.kosherjava.zmanim.util.GeoLocation; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; TimeZone tz = TimeZone.getTimeZone("America/New_York"); GeoLocation location = new GeoLocation("Lakewood, NJ", 40.096, -74.222, tz); ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location); SimpleDateFormat sdf = new SimpleDateFormat("h:mm:ss a"); sdf.setTimeZone(tz); // Multiple Alos (Dawn) calculations System.out.println("=== Alos Hashachar (Dawn) Variations ==="); System.out.println("Alos 72 minutes: " + sdf.format(czc.getAlos72())); System.out.println("Alos 60 minutes: " + sdf.format(czc.getAlos60())); System.out.println("Alos 90 minutes: " + sdf.format(czc.getAlos90())); System.out.println("Alos 96 minutes: " + sdf.format(czc.getAlos96())); System.out.println("Alos 16.1° (MGA): " + sdf.format(czc.getAlos16Point1Degrees())); System.out.println("Alos 18° (Traditional): " + sdf.format(czc.getAlos18Degrees())); System.out.println("Alos 19.8° (Baal Hatanya): " + sdf.format(czc.getAlos19Point8Degrees())); // Sof Zman Shema variations System.out.println("\n=== Sof Zman Shema (Latest Shema) ==="); System.out.println("GRA (standard): " + sdf.format(czc.getSofZmanShmaGRA())); System.out.println("MGA (Magen Avraham): " + sdf.format(czc.getSofZmanShmaMGA())); System.out.println("MGA 72 minutes: " + sdf.format(czc.getSofZmanShmaMGA72Minutes())); System.out.println("MGA 16.1°: " + sdf.format(czc.getSofZmanShmaMGA16Point1Degrees())); System.out.println("Baal Hatanya: " + sdf.format(czc.getSofZmanShmaBaalHatanya())); // Sof Zman Tefila variations System.out.println("\n=== Sof Zman Tefila (Latest Shacharis) ==="); System.out.println("GRA: " + sdf.format(czc.getSofZmanTfilaGRA())); System.out.println("MGA: " + sdf.format(czc.getSofZmanTfilaMGA())); System.out.println("MGA 72 minutes: " + sdf.format(czc.getSofZmanTfilaMGA72Minutes())); System.out.println("Baal Hatanya: " + sdf.format(czc.getSofZmanTfilaBaalHatanya())); // Mincha Gedola variations System.out.println("\n=== Mincha Gedola (Earliest Mincha) ==="); System.out.println("Standard: " + sdf.format(czc.getMinchaGedola())); System.out.println("30 min after Chatzos: " + sdf.format(czc.getMinchaGedola30Minutes())); System.out.println("MGA 72 minutes: " + sdf.format(czc.getMinchaGedola72Minutes())); System.out.println("16.1°: " + sdf.format(czc.getMinchaGedola16Point1Degrees())); System.out.println("Baal Hatanya: " + sdf.format(czc.getMinchaGedolaBaalHatanya())); // Plag HaMincha variations System.out.println("\n=== Plag HaMincha ==="); System.out.println("Standard: " + sdf.format(czc.getPlagHamincha())); System.out.println("60 minutes: " + sdf.format(czc.getPlagHamincha60Minutes())); System.out.println("72 minutes: " + sdf.format(czc.getPlagHamincha72Minutes())); System.out.println("96 minutes: " + sdf.format(czc.getPlagHamincha96Minutes())); System.out.println("18°: " + sdf.format(czc.getPlagHamincha18Degrees())); System.out.println("Baal Hatanya: " + sdf.format(czc.getPlagHaminchaBaalHatanya())); // Tzais (Nightfall) variations System.out.println("\n=== Tzais (Nightfall) ==="); System.out.println("Standard (8.5°): " + sdf.format(czc.getTzais())); System.out.println("Tzais 72: " + sdf.format(czc.getTzais72())); System.out.println("Tzais 60: " + sdf.format(czc.getTzais60())); System.out.println("Tzais 90: " + sdf.format(czc.getTzais90())); System.out.println("Tzais 96: " + sdf.format(czc.getTzais96())); System.out.println("Tzais 16.1°: " + sdf.format(czc.getTzais16Point1Degrees())); System.out.println("Tzais 18°: " + sdf.format(czc.getTzais18Degrees())); System.out.println("Tzais 19.8° (Baal Hatanya): " + sdf.format(czc.getTzais19Point8Degrees())); System.out.println("Tzais 26°: " + sdf.format(czc.getTzais26Degrees())); // Special times System.out.println("\n=== Special Times ==="); Date sofZmanKidushLevana = czc.getSofZmanKidushLevanaBetweenMoldos(); if (sofZmanKidushLevana != null) { System.out.println("Sof Zman Kiddush Levana: " + sdf.format(sofZmanKidushLevana)); } Date misheyakir = czc.getMisheyakir10Point2Degrees(); System.out.println("Misheyakir (10.2°): " + sdf.format(misheyakir)); ``` -------------------------------- ### Format Rosh Chodesh with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Shows how to format Rosh Chodesh (the beginning of the Jewish month) using `formatRoshChodesh`. The example demonstrates formatting in both English and Hebrew by toggling `setHebrewFormat`. ```java // Format Rosh Chodesh System.out.println("\n=== Rosh Chodesh Formatting ==="); jc.setJewishDate(5784, JewishDate.CHESHVAN, 1); hdf.setHebrewFormat(false); System.out.println("Rosh Chodesh (English): " + hdf.formatRoshChodesh(jc)); hdf.setHebrewFormat(true); System.out.println("Rosh Chodesh (Hebrew): " + hdf.formatRoshChodesh(jc)); ``` -------------------------------- ### Get Parsha (Torah Portion) Information Source: https://context7.com/kosherjava/zmanim/llms.txt Calculates and retrieves the weekly Torah portion (Parsha). The example first advances the date to the next Saturday and then retrieves the current and upcoming Parsha. It also checks for special Shabbos designations. ```java // Parsha (Torah Portion) System.out.println("\n=== Parsha Information ==="); jc.setJewishDate(5784, JewishDate.NISSAN, 1); // Move to next Shabbos while (jc.getDayOfWeek() != 7) { jc.forward(Calendar.DATE, 1); } JewishCalendar.Parsha parsha = jc.getParshah(); System.out.println("This Shabbos Parsha: " + parsha); System.out.println("Upcoming Parsha: " + jc.getUpcomingParshah()); // Special Shabbos JewishCalendar.Parsha specialParsha = jc.getSpecialShabbos(); if (specialParsha != JewishCalendar.Parsha.NONE) { System.out.println("Special Shabbos: " + specialParsha); } ``` -------------------------------- ### Format Jewish Holidays with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates formatting of Jewish holidays in both English and Hebrew. The example shows how to set the date to a specific holiday like Purim or Chanukah and then format it using `formatYomTov`. Note that Chanukah formatting includes the day number. ```java // Format holidays System.out.println("\n=== Holiday Formatting ==="); jc.setJewishDate(5784, JewishDate.ADAR_II, 14); // Purim System.out.println("Holiday (Hebrew): " + hdf.formatYomTov(jc)); hdf.setHebrewFormat(false); System.out.println("Holiday (English): " + hdf.formatYomTov(jc)); // Chanukah with day number jc.setJewishDate(5784, JewishDate.KISLEV, 27); System.out.println("Chanukah Day: " + hdf.formatYomTov(jc)); hdf.setHebrewFormat(true); System.out.println("Chanukah Day (Hebrew): " + hdf.formatYomTov(jc)); ``` -------------------------------- ### Format Omer Count with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates formatting the Omer count using `formatOmer`. The example includes standard Omer days and the special case of Lag B'Omer. It also shows how to customize the Hebrew prefix for the Omer count (e.g., using 'ל' instead of the default 'ב'). ```java // Format Omer System.out.println("\n=== Omer Formatting ==="); jc.setJewishDate(5784, JewishDate.NISSAN, 23); // 7th day of Omer hdf.setHebrewFormat(false); System.out.println("Omer (English): " + hdf.formatOmer(jc)); hdf.setHebrewFormat(true); System.out.println("Omer (Hebrew): " + hdf.formatOmer(jc)); // Lag B'Omer special case jc.setJewishDate(5784, JewishDate.IYAR, 18); // 33rd day of Omer hdf.setHebrewFormat(false); System.out.println("Lag B'Omer: " + hdf.formatOmer(jc)); // Customize Omer prefix (ב or ל) hdf.setHebrewFormat(true); hdf.setHebrewOmerPrefix("\u05DC"); // ל instead of ב jc.setJewishDate(5784, JewishDate.NISSAN, 23); System.out.println("Omer with ל prefix: " + hdf.formatOmer(jc)); ``` -------------------------------- ### Calculate Basic Zmanim with ZmanimCalendar Source: https://context7.com/kosherjava/zmanim/llms.txt Use ZmanimCalendar to calculate astronomical times and common zmanim for a specific location and date. Ensure proper timezone and GeoLocation setup. Handles null return values for extreme locations. ```java import com.kosherjava.zmanim.ZmanimCalendar; import com.kosherjava.zmanim.util.GeoLocation; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; // Setup location and calendar TimeZone tz = TimeZone.getTimeZone("America/New_York"); GeoLocation location = new GeoLocation("Lakewood, NJ", 40.096, -74.222, tz); ZmanimCalendar zc = new ZmanimCalendar(location); // Optionally set a specific date Calendar cal = Calendar.getInstance(tz); cal.set(2024, Calendar.MARCH, 15); // March 15, 2024 zc.setCalendar(cal); SimpleDateFormat sdf = new SimpleDateFormat("h:mm:ss a"); sdf.setTimeZone(tz); // Basic astronomical times Date sunrise = zc.getSunrise(); Date sunset = zc.getSunset(); Date seaLevelSunrise = zc.getSeaLevelSunrise(); Date seaLevelSunset = zc.getSeaLevelSunset(); System.out.println("=== Astronomical Times ==="); System.out.println("Sunrise: " + sdf.format(sunrise)); System.out.println("Sunset: " + sdf.format(sunset)); System.out.println("Sea Level Sunrise: " + sdf.format(seaLevelSunrise)); System.out.println("Sea Level Sunset: " + sdf.format(seaLevelSunset)); // Common Zmanim Date alos = zc.getAlosHashachar(); // Dawn (72 minutes before sunrise) Date misheyakir = zc.getMisheyakir11Degrees(); // Earliest time for tallis/tefillin Date sofZmanShma = zc.getSofZmanShmaGRA(); // Latest Shema (GRA) Date sofZmanTfila = zc.getSofZmanTfilaGRA(); // Latest Shacharis (GRA) Date chatzos = zc.getChatzos(); // Midday Date minchaGedola = zc.getMinchaGedola(); // Earliest Mincha Date minchaKetana = zc.getMinchaKetana(); // Mincha Ketana Date plagHamincha = zc.getPlagHamincha(); // Plag HaMincha Date tzais = zc.getTzais(); // Nightfall (8.5° below horizon) Date tzais72 = zc.getTzais72(); // Nightfall (72 minutes after sunset) System.out.println("\n=== Zmanim ==="); System.out.println("Alos Hashachar: " + sdf.format(alos)); System.out.println("Misheyakir: " + sdf.format(misheyakir)); System.out.println("Sof Zman Shema (GRA): " + sdf.format(sofZmanShma)); System.out.println("Sof Zman Tefila (GRA): " + sdf.format(sofZmanTfila)); System.out.println("Chatzos: " + sdf.format(chatzos)); System.out.println("Mincha Gedola: " + sdf.format(minchaGedola)); System.out.println("Mincha Ketana: " + sdf.format(minchaKetana)); System.out.println("Plag HaMincha: " + sdf.format(plagHamincha)); System.out.println("Tzais: " + sdf.format(tzais)); System.out.println("Tzais 72: " + sdf.format(tzais72)); // Calculate shaah zmanis (temporal hour) long shaahZmanisGRA = zc.getShaahZmanisGra(); // in milliseconds System.out.println("\nShaah Zmanis (GRA): " + (shaahZmanisGRA / 60000) + " minutes"); // Handle null values for extreme locations (e.g., polar regions) Date sunriseCheck = zc.getSunrise(); if (sunriseCheck == null) { System.out.println("No sunrise today (polar region or extreme date)"); } ``` -------------------------------- ### Get Molad (New Moon) Information Source: https://context7.com/kosherjava/zmanim/llms.txt Retrieves the Molad (conjunction of the moon) for the current Hebrew month. The result is a JewishDate object containing the month, day, and year of the Molad. ```java // Molad (New Moon) System.out.println("\n=== Molad ==="); JewishDate molad = jc.getMolad(); System.out.println("Molad of current month: " + molad.getJewishMonth() + "/" + molad.getJewishDayOfMonth() + "/" + molad.getJewishYear()); ``` -------------------------------- ### Get Hebrew Date Information Source: https://context7.com/kosherjava/zmanim/llms.txt Retrieves various components of the Hebrew date, including year, month, day, day of the week, and whether it's a leap year. The day of the week is represented numerically where 1 is Sunday and 7 is Saturday. ```java // Get Hebrew date information System.out.println("=== Hebrew Date ==="); System.out.println("Jewish Year: " + jc.getJewishYear()); System.out.println("Jewish Month: " + jc.getJewishMonth()); System.out.println("Jewish Day: " + jc.getJewishDayOfMonth()); System.out.println("Day of Week: " + jc.getDayOfWeek()); // 1=Sunday, 7=Saturday System.out.println("Is Leap Year: " + jc.isJewishLeapYear()); ``` -------------------------------- ### Format Kviah (Year Type) with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates how to get the formatted Kviah (year type) for a given Hebrew year using `getFormattedKviah`. This function returns a string representing the year type, such as 'ปก' for a regular year or 'בשה' for a leap year. ```java // Kviah (year type) formatting System.out.println("\n=== Kviah (Year Type) ==="); System.out.println("Kviah for 5784: " + hdf.getFormattedKviah(5784)); System.out.println("Kviah for 5785: " + hdf.getFormattedKviah(5785)); ``` -------------------------------- ### Setting Up GeoLocation in KosherJava Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates how to create and use the GeoLocation class to store location data, including latitude, longitude, elevation, and timezone. It also shows how to access properties and calculate distances and bearings between locations. ```java import com.kosherjava.zmanim.util.GeoLocation; import java.util.TimeZone; // Create a GeoLocation for Lakewood, NJ GeoLocation lakewood = new GeoLocation( "Lakewood, NJ", // Location name for display 40.096, // Latitude (negative for south) -74.222, // Longitude (negative for west of Prime Meridian) TimeZone.getTimeZone("America/New_York") ); // Create a GeoLocation with elevation (in meters) GeoLocation jerusalem = new GeoLocation( "Jerusalem, Israel", 31.7683, // Latitude 35.2137, // Longitude (positive for east) 800, // Elevation in meters TimeZone.getTimeZone("Asia/Jerusalem") ); // Using degrees, minutes, seconds format GeoLocation london = new GeoLocation(); london.setLocationName("London, UK"); london.setLatitude(51, 30, 26, "N"); // 51°30'26" North london.setLongitude(0, 7, 39, "W"); // 0°7'39" West london.setTimeZone(TimeZone.getTimeZone("Europe/London")); // Access location properties System.out.println("Location: " + lakewood.getLocationName()); System.out.println("Latitude: " + lakewood.getLatitude()); System.out.println("Longitude: " + lakewood.getLongitude()); System.out.println("Elevation: " + lakewood.getElevation() + " meters"); System.out.println("Timezone: " + lakewood.getTimeZone().getID()); // Calculate geodesic distance between two locations (in meters) double distance = lakewood.getGeodesicDistance(jerusalem); System.out.println("Distance to Jerusalem: " + (distance / 1000) + " km"); // Get bearing to another location double bearing = lakewood.getGeodesicInitialBearing(jerusalem); System.out.println("Initial bearing to Jerusalem: " + bearing + "°"); ``` -------------------------------- ### Initialize and Set JewishCalendar Dates Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates creating a JewishCalendar instance for the current date, setting it to a specific Gregorian date, or a specific Jewish date. Ensure correct month indexing for Gregorian dates (0-11) and Jewish date components. ```java import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar; import com.kosherjava.zmanim.hebrewcalendar.JewishDate; import java.util.Calendar; // Create a JewishCalendar for today JewishCalendar jc = new JewishCalendar(); // Or set to a specific Gregorian date Calendar cal = Calendar.getInstance(); cal.set(2024, Calendar.MARCH, 25); // March 25, 2024 jc.setGregorianDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)); // Or set to a specific Jewish date jc.setJewishDate(5784, JewishDate.ADAR_II, 15); // 15 Adar II 5784 (Purim) ``` -------------------------------- ### Add Gradle Kotlin DSL Dependency for KosherJava Zmanim Source: https://github.com/kosherjava/zmanim/blob/master/README.md Add this implementation line to your build.gradle.kts file to include the KosherJava Zmanim library in your Gradle project. ```kotlin implementation("com.kosherjava:zmanim:2.5.0") ``` -------------------------------- ### Add Gradle Dependency for KosherJava Zmanim Source: https://github.com/kosherjava/zmanim/blob/master/README.md Add this implementation line to your build.gradle file to include the KosherJava Zmanim library in your Gradle project. ```groovy implementation 'com.kosherjava:zmanim:2.5.0' ``` -------------------------------- ### Sefirat HaOmer (Counting the Omer) Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates how to count the days of the Omer. The code sets the date to the first day of Omer and then iterates for seven days, printing the day of the Omer count if applicable. ```java // Omer counting System.out.println("\n=== Sefirat HaOmer ==="); jc.setJewishDate(5784, JewishDate.NISSAN, 16); // First day of Omer for (int i = 0; i < 7; i++) { int omer = jc.getDayOfOmer(); if (omer != -1) { System.out.println("Day " + omer + " of the Omer"); } jc.forward(Calendar.DATE, 1); } ``` -------------------------------- ### Calculate and Format Daf Yomi Bavli and Yerushalmi Source: https://context7.com/kosherjava/zmanim/llms.txt Calculates the daily Talmud Daf for both Bavli and Yerushalmi using the YomiCalculator and YerushalmiYomiCalculator. Formats the output in both English and Hebrew. ```java import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar; import com.kosherjava.zmanim.hebrewcalendar.HebrewDateFormatter; import com.kosherjava.zmanim.hebrewcalendar.Daf; import com.kosherjava.zmanim.hebrewcalendar.YomiCalculator; import com.kosherjava.zmanim.hebrewcalendar.YerushalmiYomiCalculator; JewishCalendar jc = new JewishCalendar(); HebrewDateFormatter hdf = new HebrewDateFormatter(); // Daf Yomi Bavli Daf dafBavli = YomiCalculator.getDafYomiBavli(jc); System.out.println("=== Daf Yomi Bavli ==="); System.out.println("Masechta: " + dafBavli.getMasechtaTransliterated()); System.out.println("Daf: " + dafBavli.getDaf()); hdf.setHebrewFormat(false); System.out.println("Formatted (English): " + hdf.formatDafYomiBavli(dafBavli)); hdf.setHebrewFormat(true); System.out.println("Formatted (Hebrew): " + hdf.formatDafYomiBavli(dafBavli)); // Daf Yomi Yerushalmi Daf dafYerushalmi = YerushalmiYomiCalculator.getDafYomiYerushalmi(jc); System.out.println("\n=== Daf Yomi Yerushalmi ==="); if (dafYerushalmi != null) { System.out.println("Masechta: " + dafYerushalmi.getYerushalmiMasechtaTransliterated()); System.out.println("Daf: " + dafYerushalmi.getDaf()); hdf.setHebrewFormat(false); System.out.println("Formatted (English): " + hdf.formatDafYomiYerushalmi(dafYerushalmi)); hdf.setHebrewFormat(true); System.out.println("Formatted (Hebrew): " + hdf.formatDafYomiYerushalmi(dafYerushalmi)); } else { System.out.println("No Daf Yomi Yerushalmi today (Yom Kippur/Tisha B'Av)"); } ``` -------------------------------- ### Format Jewish Dates and Times with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Demonstrates default transliterated and Hebrew formatting for full dates, months, and days of the week using HebrewDateFormatter. Ensure necessary imports are included. ```java import com.kosherjava.zmanim.hebrewcalendar.HebrewDateFormatter; import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar; import com.kosherjava.zmanim.hebrewcalendar.JewishDate; import com.kosherjava.zmanim.hebrewcalendar.Daf; HebrewDateFormatter hdf = new HebrewDateFormatter(); JewishCalendar jc = new JewishCalendar(); jc.setJewishDate(5784, JewishDate.ADAR_II, 15); // Purim // Default transliterated format System.out.println("=== Transliterated Format ==="); System.out.println("Full Date: " + hdf.format(jc)); System.out.println("Month: " + hdf.formatMonth(jc)); System.out.println("Day of Week: " + hdf.formatDayOfWeek(jc)); // Hebrew format hdf.setHebrewFormat(true); System.out.println("\n=== Hebrew Format ==="); System.out.println("Full Date: " + hdf.format(jc)); System.out.println("Month: " + hdf.formatMonth(jc)); System.out.println("Day of Week: " + hdf.formatDayOfWeek(jc)); ``` -------------------------------- ### Format Parsha with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Illustrates how to format the weekly Torah portion (Parsha) using `formatParsha`. The code first finds the next Saturday to determine the correct Parsha and then formats it in both English and Hebrew. Ensure the date is set to a Saturday for accurate Parsha determination. ```java // Format Parsha System.out.println("\n=== Parsha Formatting ==="); jc.setJewishDate(5784, JewishDate.TISHREI, 7); // Shabbos // Find the next Shabbos while (jc.getDayOfWeek() != 7) { jc.forward(java.util.Calendar.DATE, 1); } hdf.setHebrewFormat(false); System.out.println("Parsha (English): " + hdf.formatParsha(jc)); hdf.setHebrewFormat(true); System.out.println("Parsha (Hebrew): " + hdf.formatParsha(jc)); ``` -------------------------------- ### Customize Transliterated Day of Week Names Source: https://context7.com/kosherjava/zmanim/llms.txt Shows how to customize the transliterated name for 'Shabbat' using `setTransliteratedShabbosDayOfWeek`. This allows for different pronunciations or spellings, such as the Sephardi pronunciation 'Shabbat'. ```java // Customizing transliterated names System.out.println("\n=== Custom Transliteration ==="); hdf.setHebrewFormat(false); hdf.setTransliteratedShabbosDayOfWeek("Shabbat"); // Sephardi pronunciation jc.setJewishDate(5784, JewishDate.TISHREI, 7); while (jc.getDayOfWeek() != 7) { jc.forward(java.util.Calendar.DATE, 1); } System.out.println("Shabbat spelling: " + hdf.formatDayOfWeek(jc)); ``` -------------------------------- ### Add Maven Dependency for KosherJava Zmanim Source: https://github.com/kosherjava/zmanim/blob/master/README.md Add this dependency to your pom.xml to include the KosherJava Zmanim library in your Maven project. ```xml com.kosherjava zmanim 2.5.0 ``` -------------------------------- ### Format Hebrew Numbers with HebrewDateFormatter Source: https://context7.com/kosherjava/zmanim/llms.txt Shows how to format integers into their Hebrew numeral equivalents using HebrewDateFormatter. Special cases for 15 (טו) and 16 (טז) are handled. The use of long year format can be enabled for numbers representing years. ```java System.out.println("\n=== Hebrew Numbers ==="); System.out.println("15 in Hebrew: " + hdf.formatHebrewNumber(15)); // טו (special case) System.out.println("16 in Hebrew: " + hdf.formatHebrewNumber(16)); // טז (special case) System.out.println("21 in Hebrew: " + hdf.formatHebrewNumber(21)); System.out.println("5784 in Hebrew: " + hdf.formatHebrewNumber(5784)); // Long year format (with thousands) hdf.setUseLongHebrewYears(true); System.out.println("5784 (long): " + hdf.formatHebrewNumber(5784)); hdf.setUseLongHebrewYears(false); ``` -------------------------------- ### Set Regional Settings (In Israel) Source: https://context7.com/kosherjava/zmanim/llms.txt Configures the JewishCalendar to use settings specific to Israel. This affects holiday observance, such as the duration of Yom Tov, which is one day shorter in Israel. ```java // Israeli vs Diaspora calendar System.out.println("\n=== Regional Settings ==="); jc.setInIsrael(true); System.out.println("In Israel setting: " + jc.getInIsrael()); // In Israel, holidays are one day shorter (no second day Yom Tov) ``` -------------------------------- ### Customize Geresh/Gershayim and Day of Week Format Source: https://context7.com/kosherjava/zmanim/llms.txt Explains how to control the use of Geresh/Gershayim characters in Hebrew number formatting and how to switch between long and short formats for the day of the week. These settings affect the output of `formatHebrewNumber` and `formatDayOfWeek`. ```java // Geresh/Gershayim settings System.out.println("\n=== Geresh/Gershayim Settings ==="); hdf.setUseGershGershayim(true); // Default System.out.println("With Gershayim: " + hdf.formatHebrewNumber(21)); hdf.setUseGershGershayim(false); System.out.println("Without Gershayim: " + hdf.formatHebrewNumber(21)); // Short vs Long day of week format System.out.println("\n=== Day of Week Format ==="); hdf.setHebrewFormat(true); hdf.setUseGershGershayim(true); hdf.setLongWeekFormat(true); // Default System.out.println("Long format: " + hdf.formatDayOfWeek(jc)); hdf.setLongWeekFormat(false); System.out.println("Short format: " + hdf.formatDayOfWeek(jc)); ``` -------------------------------- ### Check for Holidays Source: https://context7.com/kosherjava/zmanim/llms.txt Determines if the current date falls on a holiday and retrieves its index. Specific checks for Rosh Hashanah, Yom Kippur, and Chanukah are demonstrated, including properties like 'Is Yom Tov' and 'Is Taanis'. ```java // Check for holidays System.out.println("\n=== Holiday Information ==="); int yomTovIndex = jc.getYomTovIndex(); if (yomTovIndex != -1) { System.out.println("Holiday Index: " + yomTovIndex); } // Check specific holidays jc.setJewishDate(5784, JewishDate.TISHREI, 1); // Rosh Hashanah System.out.println("\nRosh Hashanah (1 Tishrei 5784):"); System.out.println("Is Rosh Hashanah: " + (jc.getYomTovIndex() == JewishCalendar.ROSH_HASHANA)); System.out.println("Is Yom Tov: " + jc.isYomTov()); System.out.println("Is Assur Bemelacha: " + jc.isAssurBemelacha()); // Work prohibited jc.setJewishDate(5784, JewishDate.TISHREI, 10); // Yom Kippur System.out.println("\nYom Kippur (10 Tishrei 5784):"); System.out.println("Is Yom Kippur: " + (jc.getYomTovIndex() == JewishCalendar.YOM_KIPPUR)); System.out.println("Is Taanis (Fast): " + jc.isTaanis()); jc.setJewishDate(5784, JewishDate.KISLEV, 25); // Chanukah System.out.println("\nChanukah (25 Kislev 5784):"); System.out.println("Is Chanukah: " + jc.isChanukah()); System.out.println("Day of Chanukah: " + jc.getDayOfChanukah()); ``` -------------------------------- ### Check for Rosh Chodesh Source: https://context7.com/kosherjava/zmanim/llms.txt A simple check to determine if a given Jewish date falls on Rosh Chodesh (the beginning of a Hebrew month). ```java // Rosh Chodesh System.out.println("\n=== Rosh Chodesh ==="); jc.setJewishDate(5784, JewishDate.IYAR, 1); System.out.println("Is Rosh Chodesh: " + jc.isRoshChodesh()); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.