php-doc-en/reference/mongo/mongodate.xml
Kristina Chodorow 174a4af91f added some security info
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@301704 c90b9560-bf6c-de11-be94-00142212c4b1
2010-07-29 21:58:57 +00:00

104 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongodate" 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 MongoDate class</title>
<titleabbrev>MongoDate</titleabbrev>
<partintro>
<!-- {{{ Mongodate intro -->
<section xml:id="mongodate.intro">
&reftitle.intro;
<para>
Represent date objects for the database. This class should be used to save
dates to the database and to query for dates. For example:
</para>
<programlisting role="php">
<![CDATA[
<?php
// save a date to the database
$collection->save(array("ts" => new MongoDate()));
$start = new MongoDate(strtotime("2010-01-15 00:00:00"));
$end = new MongoDate(strtotime("2010-01-30 00:00:00"));
// find dates between 1/15/2010 and 1/30/2010
$collection->find(array("ts" => array('$gt' => $start, '$lte' => $end)));
?>
]]>
</programlisting>
<para>
MongoDB stores dates as milliseconds past the epoch. This means that dates
<emphasis>do not</emphasis> contain timezone information. Timezones must be
stored in a separate field if needed. Second, this means that any precision
beyond milliseconds will be lost when the document is sent to/from the
database.
</para>
</section>
<!-- }}} -->
<section xml:id="mongodate.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoDate</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoDate</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Fields</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<type>int</type>
<varname>sec</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<type>int</type>
<varname>usec</varname>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongodate')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mongo.entities.mongodate;
</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
-->