jdtogregorian()函数是一个内置函数,用于转换 朱利安日整数 到 格里高利日期 函数接受一个儒略日整数,并返回转换后的公历日期 $month/$day/$year。
null
语法:
jdtogregorian($jd)
参数: 该函数接受一个强制参数 $jd 它指定了朱利安日。
返回值: 函数返回公历日期。日期的返回格式为 $month/$day/$year。
例如:
Input : 2458209 Output : 3/31/2018 Input : 2458236 Output : 4/27/2018
下面的程序演示了jdtogregorian()函数。
项目1: 下面的程序演示了jdtogregorian()函数的用法。
<?php // PHP program to demonstrate the // use of jdtogregorian() function // converts date to julian integer $jd = gregoriantojd(3, 31, 2018); // converts the Julian day to Gregorian date $date = jdtogregorian( $jd ); // prints the date echo ( $date ), "" ; ?> |
输出:
3/31/2018
项目2: 下面的程序显示了传递无效的Julian day整数时的输出。
<?php // PHP program to demonstrate the output // of jdtogregorian() function when 0 is // passed as Julian Day, which is invalid // converts the Julian day to Gregorian date // invalid hence outputs 0/0/0 $date = jdtogregorian(0); // prints the date echo ( $date ), "" ; ?> |
输出:
0/0/0
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END