<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.datetimeinterface" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

 <title>The DateTimeInterface interface</title>
 <titleabbrev>DateTimeInterface</titleabbrev>

 <partintro>

<!-- {{{ DateTimeInterface intro -->
  <section xml:id="datetimeinterface.intro">
   &reftitle.intro;
   <para>
    <interfacename>DateTimeInterface</interfacename> was created
    so that parameter, return, or property type declarations may accept either 
    <classname>DateTimeImmutable</classname> or <classname>DateTime</classname>
    as a value. It is not possible to
    implement this interface with userland classes.
   </para>
   <para>
    Common constants that allow for formatting
    <classname>DateTimeImmutable</classname> or
    <classname>DateTime</classname> objects through
    <methodname>DateTimeImmutable::format</methodname> and
    <methodname>DateTime::format</methodname> are also defined on this
    interface.
   </para>
  </section>
<!-- }}} -->

  <section xml:id="datetimeinterface.synopsis">
   &reftitle.interfacesynopsis;

<!-- {{{ Synopsis -->
   <classsynopsis class="interface">
    <oointerface>
     <interfacename>DateTimeInterface</interfacename>
    </oointerface>

    <classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.atom">DateTimeInterface::ATOM</varname>
     <initializer>"Y-m-d\\TH:i:sP"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.cookie">DateTimeInterface::COOKIE</varname>
     <initializer>"l, d-M-Y H:i:s T"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.iso8601">DateTimeInterface::ISO8601</varname>
     <initializer>"Y-m-d\\TH:i:sO"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.iso8601-expanded">DateTimeInterface::ISO8601_EXPANDED</varname>
     <initializer>"X-m-d\\TH:i:sP"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc822">DateTimeInterface::RFC822</varname>
     <initializer>"D, d M y H:i:s O"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc850">DateTimeInterface::RFC850</varname>
     <initializer>"l, d-M-y H:i:s T"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc1036">DateTimeInterface::RFC1036</varname>
     <initializer>"D, d M y H:i:s O"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc1123">DateTimeInterface::RFC1123</varname>
     <initializer>"D, d M Y H:i:s O"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc7231">DateTimeInterface::RFC7231</varname>
     <initializer>"D, d M Y H:i:s \\G\\M\\T"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc2822">DateTimeInterface::RFC2822</varname>
     <initializer>"D, d M Y H:i:s O"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc3339">DateTimeInterface::RFC3339</varname>
     <initializer>"Y-m-d\\TH:i:sP"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rfc3339-extended">DateTimeInterface::RFC3339_EXTENDED</varname>
     <initializer>"Y-m-d\\TH:i:s.vP"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.rss">DateTimeInterface::RSS</varname>
     <initializer>"D, d M Y H:i:s O"</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier>const</modifier>
     <type>string</type>
     <varname linkend="datetimeinterface.constants.w3c">DateTimeInterface::W3C</varname>
     <initializer>"Y-m-d\\TH:i:sP"</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.datetimeinterface')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DateTimeInterface'])">
     <xi:fallback/>
    </xi:include>
   </classsynopsis>
<!-- }}} -->

  </section>

<!-- {{{ DateTimeInterface constants -->
  <section xml:id="datetimeinterface.constants.types">
   &reftitle.constants;
   <variablelist>
    <varlistentry xml:id="datetimeinterface.constants.atom">
     <term><constant>DateTimeInterface::ATOM</constant></term>
     <term><constant>DATE_ATOM</constant></term>
     <listitem>
      <simpara>
       Atom (example: 2005-08-15T15:52:01+00:00)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.cookie">
     <term><constant>DateTimeInterface::COOKIE</constant></term>
     <term><constant>DATE_COOKIE</constant></term>
     <listitem>
      <simpara>
       HTTP Cookies (example: Monday, 15-Aug-2005 15:52:01 UTC)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.iso8601">
     <term><constant>DateTimeInterface::ISO8601</constant></term>
     <term><constant>DATE_ISO8601</constant></term>
     <listitem>
      <simpara>
       ISO-8601 (example: 2005-08-15T15:52:01+0000)
      </simpara>
      <note>
       <simpara>
        This format is not compatible with ISO-8601, but is left this way for
        backward compatibility reasons. Use
        <constant>DateTimeInterface::ISO8601_EXPANDED</constant>,
        <constant>DateTimeInterface::ATOM</constant> for compatibility with ISO-8601
        instead. (ref ISO8601:2004 section 4.3.3 clause d)
       </simpara>
      </note>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.iso8601-expanded">
     <term><constant>DateTimeInterface::ISO8601_EXPANDED</constant></term>
     <term><constant>DATE_ISO8601_EXPANDED</constant></term>
     <listitem>
      <simpara>
       ISO-8601 Expanded (example: +10191-07-26T08:59:52+01:00)
      </simpara>
      <note>
       <simpara>
        This format allows for year ranges outside of ISO-8601's normal range
        of <literal>0000</literal>-<literal>9999</literal> by always
        including a sign character. It also addresses that that timezone part
        (<literal>+01:00</literal>) is compatible with ISO-8601.
       </simpara>
      </note>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc822">
     <term><constant>DateTimeInterface::RFC822</constant></term>
     <term><constant>DATE_RFC822</constant></term>
     <listitem>
      <simpara>
       RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc850">
     <term><constant>DateTimeInterface::RFC850</constant></term>
     <term><constant>DATE_RFC850</constant></term>
     <listitem>
      <simpara>
       RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc1036">
     <term><constant>DateTimeInterface::RFC1036</constant></term>
     <term><constant>DATE_RFC1036</constant></term>
     <listitem>
      <simpara>
       RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc1123">
     <term><constant>DateTimeInterface::RFC1123</constant></term>
     <term><constant>DATE_RFC1123</constant></term>
     <listitem>
      <simpara>
       RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc7231">
      <term><constant>DateTimeInterface::RFC7231</constant></term>
      <term><constant>DATE_RFC7231</constant></term>
      <listitem>
       <simpara>
        RFC 7231 (since PHP 7.0.19 and 7.1.5) (example: Sat, 30 Apr 2016 17:52:13 GMT)
       </simpara>
      </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc2822">
     <term><constant>DateTimeInterface::RFC2822</constant></term>
     <term><constant>DATE_RFC2822</constant></term>
     <listitem>
      <simpara>
       RFC 2822 (example: Mon, 15 Aug 2005 15:52:01 +0000)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc3339">
     <term><constant>DateTimeInterface::RFC3339</constant></term>
     <term><constant>DATE_RFC3339</constant></term>
     <listitem>
      <simpara>
       Same as <constant>DATE_ATOM</constant>
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rfc3339-extended">
     <term><constant>DateTimeInterface::RFC3339_EXTENDED</constant></term>
     <term><constant>DATE_RFC3339_EXTENDED</constant></term>
     <listitem>
      <simpara>
       RFC 3339 EXTENDED format (example: 2005-08-15T15:52:01.000+00:00)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.rss">
     <term><constant>DateTimeInterface::RSS</constant></term>
     <term><constant>DATE_RSS</constant></term>
     <listitem>
      <simpara>
       RSS (example: Mon, 15 Aug 2005 15:52:01 +0000)
      </simpara>
     </listitem>
    </varlistentry>

    <varlistentry xml:id="datetimeinterface.constants.w3c">
     <term><constant>DateTimeInterface::W3C</constant></term>
     <term><constant>DATE_W3C</constant></term>
     <listitem>
      <simpara>
       World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)
      </simpara>
     </listitem>
    </varlistentry>

   </variablelist>
  </section>
<!-- }}} -->

 <section role="changelog" xml:id="datetimeinterface.changelog"><!-- {{{ -->
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>8.2.0</entry>
       <entry>
        The constant <constant linkend="datetimeinterface.constants.iso8601-expanded">DateTimeInterface::ISO8601_EXPANDED</constant>
        was added.
       </entry>
      </row>
      <row>
       <entry>7.2.0</entry>
       <entry>
        The class constants of <classname>DateTime</classname> are now defined
        on <interfacename>DateTimeInterface</interfacename>.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </section><!-- }}} -->

 </partintro>

 &reference.datetime.entities.datetimeinterface;

</phpdoc:classref>
<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
