How to Convert Julian Day into a Specified Calendar in PHP

PHP cal_from_jd()

The cal_from_jd() function converts the specified Julian day into a date of the specified calendar.

Syntax of this function:

cal_from_jd(jd,calendar) jd - A number (a Julian day count). (required) calendar - specifies the calendar to use. (required) The following calendar values can be used:
  • CAL_GREGORIAN
  • CAL_JULIAN
  • CAL_JEWISH
  • CAL_FRENCH
Example
It shows the basic use of this function.
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>PHP cal_from_jd()</title>
  5. </head>
  6. <body>
  7.  
  8. <?php
  9. $d=unixtojd(mktime(0,0,0,1,18,2006));
  10. print_r(cal_from_jd($d,CAL_GREGORIAN));
  11. ?>
  12.  
  13. </body>
  14. </html>
This is the output of the codes above.
result

Tags

Add new comment