jdtojewish

(PHP 4, PHP 5)

jdtojewish — Converts a Julian day count to a Jewish calendar date

Описание

string jdtojewish ( int $juliandaycount [, bool $hebrew [, int $fl ]] )

Converts a Julian Day Count to the Jewish Calendar.

Список параметров

julianday

A julian day number as integer

hebrew

If the hebrew parameter is set to TRUE, the fl parameter is used for Hebrew, string based, output format.

fl

The available formats are: CAL_JEWISH_ADD_ALAFIM_GERESH, CAL_JEWISH_ADD_ALAFIM, CAL_JEWISH_ADD_GERESHAYIM.

Возвращаемые значения

The jewish date as a string in the form "month/day/year"

Список изменений

Версия Описание
5.0.0 The hebrew and fl parameters were added

Примеры

Пример #1 jdtojewish() Example

<?php
echo jdtojewish(gregoriantojd(1082002), true,
       
CAL_JEWISH_ADD_GERESHAYIM CAL_JEWISH_ADD_ALAFIM CAL_JEWISH_ADD_ALAFIM_GERESH); 
?>

Смотрите также

Коментарии

There's probably a simpler way to do this, but I needed to convert a Gregorian date to a Hebrew one and display it with the Hebrew month name (not the number).

Perhaps it can help somebody...

<?php

//enter your Gregorian date with the variables $gregorianMonth, $gregorianDay, and $gregorianYear using the numerical representation of the month

$jdDate gregoriantojd $gregorianMonth$gregorianDay$gregorianYear);

$gregorianMonthName jdmonthname $jdDate);

$hebrewDate jdtojewish ($jdDate);

list (
$hebrewMonth$hebrewDay$hebrewYear) = split ('/'$hebrewDate);

$hebrewMonthName jdmonthname $jdDate4); 

 echo 
"Your date in Hebrew would read: $hebrewDay $hebrewMonthName $hebrewYear";

?>
2002-03-04 18:04:03
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
Based on the code already posted by Dave, I've modified it to display the *current* date on a page:

<?php 

$gregorianMonth 
date(n);
$gregorianDay date(j);
$gregorianYear date(Y);

$jdDate gregoriantojd($gregorianMonth,$gregorianDay,$gregorianYear); 

$hebrewMonthName jdmonthname($jdDate,4);

$hebrewDate jdtojewish($jdDate); 

list(
$hebrewMonth$hebrewDay$hebrewYear) = split('/',$hebrewDate); 

echo 
"$hebrewDay $hebrewMonthName $hebrewYear";
?>
2003-09-01 14:39:24
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
This function outputs in ISO-8859-8-l.

To convert to unicode UTF-8 do this:

<?php

echo mb_convert_encodingjdtojewishunixtojd(), true ), "UTF-8""ISO-8859-8");

?>
2007-05-28 17:10:10
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
In Hebrew leap years, the function will return 6 for Adar A, 7 for Adar B, 8 for Nisan, etc.

In Hebrew non-leap years, the function will return 6 for Adar, 8 for Nisan, etc.

i.e., the "real" Adar is Adar A.
2009-08-29 17:01:06
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
Sometimes it is useful to have the date in the format YYYY-MM-DD, which is sortable (e.g. you can sort dates by sorting the strings):

<?php
function JDToSortableJewish($jd) {
    return 
       
preg_replace("|(\d+)/(\d+)/(\d+)|","$3-$1-$2"// year-month-day
       
preg_replace("|/(\d)/|","/0$1/"// add zeros to the day
       
preg_replace("|^(\d)/|","0$1/"// add zeros to the month
       
JDToJewish($jd))));
}
?>
2009-08-29 18:28:55
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
<?php
// Hebrew date in hebrew
$str jdtojewish(gregoriantojddate('m'), date('d'), date('Y')), trueCAL_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: כ"ט אדר ה' אלפים תשע"ב

// or
$str jdtojewish(gregoriantojddate('m'), date('d'), date('Y')), trueCAL_JEWISH_ADD_GERESHAYIM); // for today
$str1 iconv ('WINDOWS-1255''UTF-8'$str); // convert to utf-8

echo $str1// for 23/03/2012 will print: כ"ט אדר התשע"ב
?>
2012-03-23 11:57:39
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
With PHP 5.5, the functionality changed regarding Adar in a non-leap year. Prior to 5.5, the month was returned as 6. In 5.5 and 5.6, the month is returned as 7. This difference is not listed under "What has changed in PHP 5.5.x".
2015-01-06 02:34:11
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
Check whether the year is leap year, in order to determine whether the value 7 = Adar or Adar 2

<?php 

$hebrewDate 
jdtojewish(gregoriantojd(date('m'$DateStamp), date('d'$DateStamp), date('Y'$DateStamp)));
list(
$hebrewMonth$hebrewDay$hebrewYear) = explode('/',$hebrewDate);

$m = array(36811141719);
$meuberet in_array(($hebrewYear 19), $m);
if(
$meuberet) if($hebrewMonth == 7$hebrewMonth '7b'//This is Adar 2
2019-05-04 23:24:09
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
Автор:
If you wish to format the hebrew date as this (ignore the brackets): [כ"ז סיון ה'תשע"ה], since none of the 3 bitmasks include this format, you can use the CAL_JEWISH_ADD_GERESHAYIM mask, and then insert the ' into the year with the second line, as shown:

$hebdate = jdtojewish(gregoriantojd(6,14,2015),1,CAL_JEWISH_ADD_GERESHAYIM);
$hebdate = substr_replace($hebdate,"'",strrpos($hebdate," ")+2,0);
2020-01-23 06:59:36
http://php5.kiev.ua/manual/ru/function.jdtojewish.html
Автор:
To check if a Jewish year is leap use this function:

function isJewishLeapYear($year) {
    return 0 != cal_days_in_month(CAL_JEWISH, 6, $year);
}

In non-leap years there is only one Adar, and its number is 7. There is no 6.
2022-02-03 10:07:45
http://php5.kiev.ua/manual/ru/function.jdtojewish.html

    Поддержать сайт на родительском проекте КГБ