Jump to content

Displaying date in Hebrew characters


darshanm

Recommended Posts

Hi,

 

I am using the below function to convert and display date in Hebrew characters. It was working till now but it has stopped working since the new year 2013. It is still using 5772 instead of 5773 for the year. Can someone please help me to fix this issue.

 

Thanks

 

function get_hebrew_date($gdate)
{
$cdate = explode("-",$gdate);
$gregorianMonth = $cdate[1];
$gregorianDay = $cdate[0];
$gregorianYear = $cdate[2];

$jdDate = gregoriantojd($gregorianMonth,$gregorianDay,$gregorianYear);
$hebrewMonthName = jdmonthname($jdDate,4);
$hebrewDate = jdtojewish($jdDate);
list($hebrewMonth, $hebrewDay, $hebrewYear) =explode('/',$hebrewDate);
// Hebrew date in hebrew
$str = jdtojewish(gregoriantojd( date('m'), date('d'), date('Y')), true, CAL_JEWISH_ADD_GERESHAYIM + CAL_JEWISH_ADD_ALAFIM + CAL_JEWISH_ADD_ALAFIM_GERESH); // for today
$str1 = iconv ('WINDOWS-1255', 'UTF-8', $str); // convert to utf-8
//echo $str1; // for 23/03/2012 will print: כ"ט אדר ה' אלפים תשע"ב
//echo "<br>";
// or
$str = jdtojewish(gregoriantojd( $gregorianMonth, $gregorianDay, $gregorianYear), true, CAL_JEWISH_ADD_GERESHAYIM); // for today
$str1 = iconv ('WINDOWS-1255', 'UTF-8', $str); // convert to utf-8
return $str1; // for 23/03/2012 will print: כ"ט אדר התשע"ב
}

Link to comment
https://forums.phpfreaks.com/topic/273614-displaying-date-in-hebrew-characters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.