How to Convert Julian Day into a Specified Calendar in PHP

Submitted by: 
Language: 
Visitors have accessed this post 145 times.

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

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.