function.cal-from-jd.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 146 行

HTML
146
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Converts from Julian Day Count to a supported calendar</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.cal-days-in-month.html">cal_days_in_month</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.cal-info.html">cal_info</a></div> <div class="up"><a href="ref.calendar.html">Calendar Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.cal-from-jd" class="refentry"> <div class="refnamediv">  <h1 class="refname">cal_from_jd</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5)</p><p class="refpurpose"><span class="refname">cal_from_jd</span> &mdash; <span class="dc-title">Converts from Julian Day Count to a supported calendar</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">array</span> <span class="methodname"><b><b>cal_from_jd</b></b></span>    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$jd</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$calendar</tt></span>   )</div>  <p class="para rdfs-comment">   <b>cal_from_jd()</b> converts the Julian day given in   <i><tt class="parameter">jd</tt></i> into a date of the specified   <i><tt class="parameter">calendar</tt></i>. Supported   <i><tt class="parameter">calendar</tt></i> values are   <b><tt>CAL_GREGORIAN</tt></b>,   <b><tt>CAL_JULIAN</tt></b>,   <b><tt>CAL_JEWISH</tt></b> and   <b><tt>CAL_FRENCH</tt></b>.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">jd</tt></i></span>     <dd>      <p class="para">       Julian day as integer      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">calendar</tt></i></span>     <dd>      <p class="para">       Calendar to convert to      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns an array containing calendar information like month, day, year,   day of week, abbreviated and full names of weekday and month and the   date in string form &quot;month/day/year&quot;.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>cal_from_jd()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$today&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">unixtojd</span><span style="color: #007700">(</span><span style="color: #0000BB">mktime</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">16</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2003</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">cal_from_jd</span><span style="color: #007700">(</span><span style="color: #0000BB">$today</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CAL_GREGORIAN</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>    <div class="example-contents"><p>The above example will output:</p></div>    <div class="example-contents"><pre><div class="cdata"><pre>Array(    [date] =&gt; 8/16/2003    [month] =&gt; 8    [day] =&gt; 16    [year] =&gt; 2003    [dow] =&gt; 6    [abbrevdayname] =&gt; Sat    [dayname] =&gt; Saturday    [abbrevmonth] =&gt; Aug    [monthname] =&gt; August)</pre></div>    </pre></div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.cal-to-jd.html" class="function" rel="rdfs-seeAlso">cal_to_jd()</a></li>    <li class="member"><a href="function.jdtofrench.html" class="function" rel="rdfs-seeAlso">jdtofrench()</a></li>      <li class="member"><a href="function.jdtogregorian.html" class="function" rel="rdfs-seeAlso">jdtogregorian()</a></li>    <li class="member"><a href="function.jdtojewish.html" class="function" rel="rdfs-seeAlso">jdtojewish()</a></li>      <li class="member"><a href="function.jdtojulian.html" class="function" rel="rdfs-seeAlso">jdtojulian()</a></li>    <li class="member"><a href="function.jdtounix.html" class="function" rel="rdfs-seeAlso">jdtounix()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.cal-days-in-month.html">cal_days_in_month</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.cal-info.html">cal_info</a></div> <div class="up"><a href="ref.calendar.html">Calendar Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?