PHP | jewishtojd()函数

函数是一个内置函数,用于转换 犹太约会 朱利安日计数 .该函数接受格式为的三个参数 $month/$day/$year ,表示犹太或希伯来历法中的日期,并将其转换为朱利安日计数。

null

语法:

jewishtojd( $month, $day, $year) 

参数: 该函数接受三个强制参数,如下所示:

  1. 每月美元- 此参数指定犹太日历中的月数。月数在1-13之间(含1-13)。如果超过12个月或少于1个月,则儒略日返回为0。
  2. $day– 此参数指定犹太日历中的日期。日数在1-30之间(含1-30)。如果通过的日数超过31或小于1,则朱利安日返回为0。闰年没有考虑在内
  3. 美元年- 此参数指定犹太日历中的年份。年份数在1-9999之间(含1-9999)。

    返回值: 函数返回转换为朱利安日计数的犹太日期。

    例如:

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

    下面的程序演示了jewishtojd()函数。

    项目1: 下面的程序演示了jewishtojd()函数的用法。

    <?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 );
    ?>

    
    

    输出:

    352465

    项目2: 下面的程序演示了日期和月份超出范围的时间。

    <?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 ), "" ;
    // day is out of range
    $jd =jewishtojd(4, 32, 11);
    echo ( $jd );
    ?>

    
    

    输出:

    0
    0

    参考: http://php.net/manual/en/function.jewishtojd.php

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享