當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


PHP jdtofrench()用法及代碼示例


jdtofrench()函數是內置函數,它將Julian Day Integer轉換為法語日期。該函數接受儒略日整數,並以$month /$day /$year返回轉換後的法語日期。

用法:

jdtofrench($jd)

參數:該函數接受一個強製參數$jd,該參數指定儒略日。


返回值:該函數返回法語日期。日期的返回格式為$month /$day /$year。如果將儒略日整數作為0傳遞,則返回0/0/0作為輸出。

例子:

Input : 2379254
Output : 5/8/10 

Input : 2380229
Output : 1/7/13

以下示例程序旨在說明jdtofrench()函數。

程序1:以下示例程序旨在說明jdtofrench()函數的用法。

<?php 
// PHP program to demonstrate the 
// use of jdtofrench() function  
  
// converts date to julian integer  
$jd = frenchtojd(1, 7, 13); 
  
// prints the julian day integer  
echo "The julian day integer is ", $jd, "\n"; 
  
// converts the Julian day to French date 
$date = jdtofrench($jd); 
  
// prints the date 
echo "The french date initially taken was ", ($date), "\n";  
  
?>

輸出:

The julian day integer is 2380229
The french date initially taken was 1/7/13

程序2:下麵的程序顯示了傳遞無效的儒略日整數時的輸出。

<?php 
// PHP program to demonstrate the 
// use of jdtofrench() function   
// in case of out of range parameter is passed  
  
// converts date to julian integer  
$jd = frenchtojd(1, 7, 18); 
  
// prints the julian day integer as 0 as year is out of range 
echo "The julian day integer is ", $jd, "\n"; 
  
// converts the Julian day to French date 
$date = jdtofrench($jd); 
  
// prints the date as 0/0/0 as french year is out of range 
echo "The french date initially taken was ", ($date), "\n";  
  
?>

輸出:

The julian day integer is 0
The french date initially taken was 0/0/0

參考:
http://php.net/manual/en/function.jdtofrench.php



相關用法


注:本文由純淨天空篩選整理自gopaldave大神的英文原創作品 PHP | jdtofrench() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。