mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9477 c90b9560-bf6c-de11-be94-00142212c4b1
340 lines
10 KiB
Text
340 lines
10 KiB
Text
|
|
<reference id="ref.calendar">
|
|
<title>Calendar Functions</title>
|
|
<titleabbrev>Calendar</titleabbrev>
|
|
|
|
<partintro>
|
|
<para>
|
|
The calendar functions are only available if you have compiled the
|
|
calendar extension in dl/calendar. Read dl/README for instructions on
|
|
using it.
|
|
</para>
|
|
<para>
|
|
The Calendar extension in PHP presents a series of functions to
|
|
simplify converting between different calendar formats. The
|
|
intermediary or standard it is based on is the Julian Day Count.
|
|
The Julian Day Count is a count of days starting way earlier than
|
|
any date most people would need to track (somewhere around
|
|
4000bc). To convert between calendar systems, you must first
|
|
convert to Julian Day Count, then to the calendar system of your
|
|
choice. Julian Day Count is very different from the Julian
|
|
Calendar! For more information on calendar systems visit <ulink
|
|
url="http://genealogy.org/~scottlee/cal-overview.html">http://genealogy.org/~scottlee/cal-overview.html</ulink>.
|
|
Excerpts from this page are included in these instructions, and
|
|
are in quotes
|
|
</partintro>
|
|
|
|
<refentry id="function.jdtogregorian">
|
|
<refnamediv>
|
|
<refname>JDToGregorian</refname>
|
|
<refpurpose>Converts Julian Day Count to Gregorian date</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>jdtogregorian</function></funcdef>
|
|
<paramdef>int <parameter>julianday</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Converts Julian Day Count to a string containing the
|
|
Gregorian date in the format of "month/day/year"
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.gregoriantojd">
|
|
<refnamediv>
|
|
<refname>GregorianToJD</refname>
|
|
<refpurpose>Converts a Gregorian date to Julian Day
|
|
Count</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>gregoriantojd</function></funcdef>
|
|
<paramdef>int <parameter>month</parameter></paramdef>
|
|
<paramdef>int <parameter>day</parameter></paramdef>
|
|
<paramdef>int <parameter>year</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Valid Range for Gregorian Calendar 4714 B.C. to 9999 A.D.
|
|
<para>
|
|
Although this software can handle dates all the way back to
|
|
4714 B.C., such use may not be meaningful. The Gregorian
|
|
calendar was not instituted until October 15, 1582 (or
|
|
October 5, 1582 in the Julian calendar). Some countries did
|
|
not accept it until much later. For example, Britain
|
|
converted in 1752, The USSR in 1918 and Greece in 1923. Most
|
|
European countries used the Julian calendar prior to the
|
|
Gregorian.
|
|
|
|
<example>
|
|
<title>Calendar functions</title>
|
|
<programlisting role=php>
|
|
<?php
|
|
$jd = GregorianToJD(10,11,1970);
|
|
echo("$jd\n");
|
|
$gregorian = JDToGregorian($jd);
|
|
echo("$gregorian\n");
|
|
?>
|
|
</programlisting>
|
|
</example>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jdtojulian">
|
|
<refnamediv>
|
|
<refname>JDToJulian</refname>
|
|
<refpurpose>Converts a Julian Calendar date to Julian Day
|
|
Count</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>jdtojulian</function></funcdef>
|
|
<paramdef>int <parameter>julianday</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Converts Julian Day Count to a string containing the Julian
|
|
Calendar Date in the format of "month/day/year".
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.juliantojd">
|
|
<refnamediv>
|
|
<refname>JulianToJD</refname>
|
|
<refpurpose>Converts a Julian Calendar date to Julian Day
|
|
Count</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>juliantojd</function></funcdef>
|
|
<paramdef>int <parameter>month</parameter></paramdef>
|
|
<paramdef>int <parameter>day</parameter></paramdef>
|
|
<paramdef>int <parameter>year</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Valid Range for Julian Calendar 4713 B.C. to 9999 A.D.
|
|
<para>
|
|
Although this software can handle dates all the way back to
|
|
4713 B.C., such use may not be meaningful. The calendar was
|
|
created in 46 B.C., but the details did not stabilize until
|
|
at least 8 A.D., and perhaps as late at the 4th
|
|
century. Also, the beginning of a year varied from one
|
|
culture to another - not all accepted January as the first
|
|
month.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jdtojewish">
|
|
<refnamediv>
|
|
<refname>JDToJewish</refname>
|
|
<refpurpose>Converts a Julian Day Count to the Jewish
|
|
Calendar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>jdtojewish</function></funcdef>
|
|
<paramdef>int <parameter>julianday</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Converts a Julian Day Count the the Jewish Calendar.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jewishtojd">
|
|
<refnamediv>
|
|
<refname>JewishToJD</refname>
|
|
<refpurpose>Converts a date in the Jewish Calendar to Julian
|
|
Day Count</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>jewishtojd</function></funcdef>
|
|
<paramdef>int <parameter>month</parameter></paramdef>
|
|
<paramdef>int <parameter>day</parameter></paramdef>
|
|
<paramdef>int <parameter>year</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Valid Range Although this software can handle dates all the
|
|
way back to the year 1 (3761 B.C.), such use may not be
|
|
meaningful.
|
|
<para>
|
|
The Jewish calendar has been in use for several thousand
|
|
years, but in the early days there was no formula to
|
|
determine the start of a month. A new month was started when
|
|
the new moon was first observed.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jdtofrench">
|
|
<refnamediv>
|
|
<refname>JDToFrench</refname>
|
|
<refpurpose>Converts a Julian Day Count to the French
|
|
Republican Calendar</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>jdtofrench</function></funcdef>
|
|
<paramdef>int <parameter>month</parameter></paramdef>
|
|
<paramdef>int <parameter>day</parameter></paramdef>
|
|
<paramdef>int <parameter>year</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Converts a Julian Day Count to the French Republican
|
|
Calendar.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.frenchtojd">
|
|
<refnamediv>
|
|
<refname>FrenchToJD</refname>
|
|
<refpurpose>Converts a date from the French Republican
|
|
Calendar to a Julian Day Count</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>frenchtojd</function></funcdef>
|
|
<paramdef>int <parameter>month</parameter></paramdef>
|
|
<paramdef>int <parameter>day</parameter></paramdef>
|
|
<paramdef>int <parameter>year</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Converts a date from the French Republican Calendar to a
|
|
Julian Day Count
|
|
<para>
|
|
These routines only convert dates in years 1 through 14
|
|
(Gregorian dates 22 September 1792 through 22 September
|
|
1806). This more than covers the period when the calendar was
|
|
in use.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jdmonthname">
|
|
<refnamediv>
|
|
<refname>JDMonthName</refname>
|
|
<refpurpose>Returns a month name</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>jdmonthname</function></funcdef>
|
|
<paramdef>int <parameter>julianday</parameter></paramdef>
|
|
<paramdef>int <parameter>mode</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns a string containing a month name.
|
|
<parameter>mode</parameter> tells this function which
|
|
calendar to convert the Julian Day Count to, and what type of
|
|
month names are to be returned.
|
|
|
|
|
|
<table>
|
|
<title>Calendar modes</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>Mode</entry>
|
|
<entry>Meaning</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>Gregorian - apreviated</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>Gregorian</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>Julian - apreviated</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>Julian</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry>Jewish</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5</entry>
|
|
<entry>French Republican</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.jddayofweek">
|
|
<refnamediv>
|
|
<refname>JDDayOfWeek</refname>
|
|
<refpurpose>Returns the day of the week</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>mixed <function>jddayofweek</function></funcdef>
|
|
<paramdef>int <parameter>julianday</parameter></paramdef>
|
|
<paramdef>int <parameter>mode</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the day of the week. Can return a string or an int
|
|
depending on the mode.
|
|
|
|
<table>
|
|
<title>Calendar week modes</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>Mode</entry>
|
|
<entry>Meaning</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry> <entry>returns the day number as an int
|
|
(0=sunday, 1=monday, etc)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry> <entry>returns string containing the day of
|
|
week (english-gregorian)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry> <entry>returns a string containing the
|
|
abreviated day of week (english-gregorian)</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
-->
|