Thursday, September 4, 2025
HomeLanguagesPHP | jewishtojd() Function

PHP | jewishtojd() Function

The jewishtojd() function is a built-in function which converts a Jewish Date to a Julian Day Count. The function accepts three parameters in format $month / $day / $year, which represents the date in Jewish or Hebrew calendar and converts it to a Julian Day count.

Syntax:

jewishtojd( $month, $day, $year) 

Parameters: The function accepts three mandatory parameters as shown above and described below:

  1. $month – This parameter specifies the month number in Jewish calendar. The month number is in range 1-13 inclusive. If a month number in excess of 12 or less than 1 is passed, the Julian day is returned as 0.
  2. $day – This parameter specifies the day in Jewish calendar. The day number is in range 1-30 inclusive. If a day number in excess of 31 or less than 1 is passed, the Julian day is returned as 0. Leap years are not taken into consideration
  3. $year – This parameter specifies the year in Jewish calendar. The year number is in range 1-9999 inclusive.
  4. Return Value: The function returns the Jewish date converted to a Julian Day count.

    Examples:

    Input : $month=4, $day=8, $year=13
    Output : 352465
    
    Input : $month=4, $day=8, $year=898
    Output : 675707
    

    Below programs illustrate the jewishtojd() function.

    Program 1: The program below demonstrates the use of jewishtojd() function.




    <?php
    // PHP program to demonstrate the
    // use of jewishtojd() function 
      
    // converts date to julian integer 
    $jd = jewishtojd(4, 8, 13);
      
    // prints the julian day integer
    echo ($jd);
    ?>

    
    

    Output:

    352465

    Program 2: The program below demonstrates when day and month out of range.




    <?php
    // PHP program to demonstrate the
    // use of jewishtojd() function 
      
    // converts date to julian integer 
    // month is out of range
    $jd = jewishtojd(22, 8, 11);
      
    // prints the julian day integer
    echo ($jd), "\n"; 
      
      
    // day is out of range
    $jd=jewishtojd(4, 32, 11);
    echo ($jd); 
    ?>

    
    

    Output:

    0
    0

    Reference:
    http://php.net/manual/en/function.jewishtojd.php

RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS