/** * Converts a Julian day count to a Jewish calendar date. * * Shim implementation of \JdtoJjewish() * * @link https://php.net/JdtoJewish * * @param int $juliandaycount A Julian Day number * @param bool $hebrew If true, the date is returned in Hebrew text * @param int $fl If $hebrew is true, then add alafim and gereshayim to the text * * @return string A string of the form "month/day/year" */ public static function jdToJewish($juliandaycount, $hebrew, $fl) { $jewish = new JewishCalendar(); if ($hebrew) { if ($juliandaycount < 347998 || $juliandaycount > 4000075) { return trigger_error('Year out of range (0-9999).', E_USER_WARNING); } $hebrew = $jewish->jdToHebrew($juliandaycount, $fl & CAL_JEWISH_ADD_ALAFIM_GERESH, $fl & CAL_JEWISH_ADD_ALAFIM, $fl & CAL_JEWISH_ADD_GERESHAYIM); // Our code generates Hebrew punctuation. PHP uses ASCII punctuation. $hebrew = strtr($hebrew, array(JewishCalendar::GERESH => "'", JewishCalendar::GERSHAYIM => '"')); // Our code generates UTF-8. PHP generates ISO-8859=8 $hebrew = mb_convert_encoding($hebrew, 'ISO-8859-8', 'UTF-8'); return $hebrew; } else { list($year, $month, $day) = $jewish->jdToYmd($juliandaycount); return $month . '/' . $day . '/' . $year; } }
/** * Converts a Julian day count to a Jewish calendar date. * * Shim implementation of \JdtoJjewish() * * @link https://php.net/JdtoJewish * * @param int $juliandaycount A Julian Day number * @param bool $hebrew If set, the date is returned in Hebrew text * @param int $fl If set, then add alafim and gereshayim to the text * * @return string A string of the form "month/day/year" */ public static function jdToJewish($juliandaycount, $hebrew = false, $fl = 0) { $jewish = new JewishCalendar(); if ($hebrew) { $hebrew = $jewish->jdToHebrew($juliandaycount, $fl & CAL_JEWISH_ADD_ALAFIM_GERESH, $fl & CAL_JEWISH_ADD_ALAFIM, $fl & CAL_JEWISH_ADD_GERESHAYIM); // Our code generates Hebrew punctuation. PHP uses ASCII punctuation. $hebrew = strtr($hebrew, array(JewishCalendar::GERESH => "'", JewishCalendar::GERSHAYIM => '"')); // Our code generates UTF-8. PHP generates ISO-8859=8 $hebrew = mb_convert_encoding($hebrew, 'ISO-8859-8', 'UTF-8'); return $hebrew; } else { list($year, $month, $day) = $jewish->jdToYmd($juliandaycount); return $month . '/' . $day . '/' . $year; } }