mirror of
https://github.com/php/doc-zh.git
synced 2026-03-24 15:12:20 +01:00
128 lines
4.1 KiB
XML
128 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 576c7c43febb2eec5718d8320f92606423413983 Maintainer: yuanyuqiang Status: ready -->
|
|
<!-- CREDITS: mowangjuanzi, Luffy -->
|
|
<reference xml:id="class.datetime" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
|
|
<title>DateTime 类</title>
|
|
<titleabbrev>DateTime</titleabbrev>
|
|
|
|
<partintro>
|
|
|
|
<!-- {{{ DateTime intro -->
|
|
<section xml:id="datetime.intro">
|
|
&reftitle.intro;
|
|
<para>
|
|
日期和时间表示。
|
|
</para>
|
|
<para>
|
|
此类与 <classname>DateTimeImmutable</classname> 行为相同。区别就是调用有修改行为的方法(比如
|
|
<function>DateTime::modify</function>)时,会修改对象本身。
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
在 <classname>DateTime</classname> 类的对象上调用方法会改变对象中封装的信息,如果想要避免这种情况,就得使用
|
|
<literal>clone</literal> 操作符创建新的对象。推荐使用 <classname>DateTimeImmutable</classname>
|
|
代替 <classname>DateTime</classname> 来获得这个默认行为。
|
|
</para>
|
|
</warning>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="datetime.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis class="class">
|
|
<ooclass>
|
|
<classname>DateTime</classname>
|
|
</ooclass>
|
|
|
|
<oointerface>
|
|
<modifier>implements</modifier>
|
|
<interfacename>DateTimeInterface</interfacename>
|
|
</oointerface>
|
|
|
|
<classsynopsisinfo role="comment">&InheritedConstants;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.datetimeinterface')/db:partintro/db:section/db:classsynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='&Constants;']]))">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.datetime')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='DateTime'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.datetime')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DateTime'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.datetimeinterface')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DateTime'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
<section role="changelog" xml:id="datetime.changelog"><!-- {{{ -->
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.4.0</entry>
|
|
<entry>
|
|
类常量现已类型化。
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.2.0</entry>
|
|
<entry>
|
|
<classname>DateTime</classname> 的类常量现在定义在 <classname>DateTimeInterface</classname> 上。
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.1.0</entry>
|
|
<entry>
|
|
现在 <classname>DateTime</classname> 构造器在构造值中包含了当前微秒。在此之前,微秒会一直初始化为 <literal>0</literal>。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</section><!-- }}} -->
|
|
|
|
|
|
</partintro>
|
|
|
|
&reference.datetime.entities.datetime;
|
|
|
|
</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
|
|
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
|
|
-->
|