2009-03-24 18:46:00 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:06:30 +00:00
|
|
|
<!-- $Revision$ -->
|
2009-03-24 18:46:00 +00:00
|
|
|
|
|
|
|
<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>
|
2009-11-12 16:39:09 +00:00
|
|
|
Represent date objects for the database. This class should be used to save
|
|
|
|
dates to the database and to query for dates. For example:
|
2009-05-29 20:03:49 +00:00
|
|
|
</para>
|
2012-11-29 05:37:54 +00:00
|
|
|
<example>
|
|
|
|
<title>Storing dates with <classname>MongoDate</classname></title>
|
|
|
|
<programlisting role="php">
|
2009-11-12 16:39:09 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
// save a date to the database
|
2010-07-09 11:28:40 +00:00
|
|
|
$collection->save(array("ts" => new MongoDate()));
|
2009-11-12 16:39:09 +00:00
|
|
|
|
|
|
|
$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)));
|
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
2012-11-29 05:37:54 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
2010-07-29 21:58:57 +00:00
|
|
|
<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>
|
2009-03-24 18:46:00 +00:00
|
|
|
</section>
|
|
|
|
<!-- }}} -->
|
|
|
|
|
|
|
|
<section xml:id="mongodate.synopsis">
|
|
|
|
&reftitle.classsynopsis;
|
|
|
|
|
|
|
|
<!-- {{{ Synopsis -->
|
|
|
|
<classsynopsis>
|
|
|
|
<ooclass><classname>MongoDate</classname></ooclass>
|
|
|
|
|
|
|
|
<!-- {{{ Class synopsis -->
|
|
|
|
<classsynopsisinfo>
|
|
|
|
<ooclass>
|
|
|
|
<classname>MongoDate</classname>
|
|
|
|
</ooclass>
|
|
|
|
</classsynopsisinfo>
|
|
|
|
<!-- }}} -->
|
|
|
|
|
2009-11-12 16:39:09 +00:00
|
|
|
<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>
|
|
|
|
|
|
|
|
|
2009-12-29 09:42:00 +00:00
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
2009-03-24 18:46:00 +00:00
|
|
|
<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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2009-03-24 18:46:00 +00:00
|
|
|
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
|
|
|
|
-->
|