Created
August 23, 2023 16:37
-
-
Save meilechwieder/d1ad34a2395f8320024584484cffac89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isJewishLeapYear($year) { | |
if ($year % 19 == 0 || $year % 19 == 3 || $year % 19 == 6 || | |
$year % 19 == 8 || $year % 19 == 11 || $year % 19 == 14 || | |
$year % 19 == 17) | |
return true; | |
else | |
return false; | |
} | |
function getJewishMonthName($jewishMonth, $jewishYear) { | |
$jewishMonthNamesLeap = array("Tishri", "Heshvan", "Kislev", "Tevet", | |
"Shevat", "Adar I", "Adar II", "Nisan", | |
"Iyar", "Sivan", "Tammuz", "Av", "Elul"); | |
$jewishMonthNamesNonLeap = array("Tishri", "Heshvan", "Kislev", "Tevet", | |
"Shevat", "", "Adar", "Nisan", | |
"Iyar", "Sivan", "Tammuz", "Av", "Elul"); | |
if (isJewishLeapYear($jewishYear)) | |
return $jewishMonthNamesLeap[$jewishMonth-1]; | |
else | |
return $jewishMonthNamesNonLeap[$jewishMonth-1]; | |
} | |
$jdNumber = gregoriantojd(8, 23, 2023); | |
$jewishDate = jdtojewish($jdNumber); | |
list($jewishMonth, $jewishDay, $jewishYear) = explode('/', $jewishDate); | |
$jewishMonthName = getJewishMonthName($jewishMonth, $jewishYear); | |
echo "<p>8, 23, 2023 is the $jewishDay $jewishMonthName $jewishYear</p>\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment