2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:46:52 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.time" xmlns="http://docbook.org/ns/docbook">
|
2005-04-24 23:50:58 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>time</refname>
|
|
|
|
<refpurpose>Return current Unix timestamp</refpurpose>
|
|
|
|
</refnamediv>
|
2006-07-11 07:05:04 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2005-04-24 23:50:58 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>time</methodname>
|
|
|
|
<void/>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Returns the current time measured in the number of seconds since
|
|
|
|
the Unix Epoch (January 1 1970 00:00:00 GMT).
|
|
|
|
</para>
|
2006-07-11 07:05:04 +00:00
|
|
|
</refsect1>
|
|
|
|
|
2021-06-15 15:27:03 +00:00
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
&no.function.parameters;
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns the current timestamp.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2006-07-11 07:05:04 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2005-04-24 23:50:58 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>time</function> example</title>
|
|
|
|
<programlisting role="php">
|
2005-03-31 04:03:19 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$nextWeek = time() + (7 * 24 * 60 * 60);
|
2014-06-13 08:12:47 +00:00
|
|
|
// 7 days; 24 hours; 60 mins; 60 secs
|
2005-03-31 04:03:19 +00:00
|
|
|
echo 'Now: '. date('Y-m-d') ."\n";
|
|
|
|
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
|
2007-01-01 10:34:56 +00:00
|
|
|
// or using strtotime():
|
|
|
|
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
|
2005-03-31 04:03:19 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2005-04-24 23:50:58 +00:00
|
|
|
</programlisting>
|
|
|
|
&example.outputs.similar;
|
|
|
|
<screen>
|
2005-03-31 04:03:19 +00:00
|
|
|
<![CDATA[
|
|
|
|
Now: 2005-03-30
|
2007-01-01 10:34:56 +00:00
|
|
|
Next Week: 2005-04-06
|
|
|
|
Next Week: 2005-04-06
|
2005-03-31 04:03:19 +00:00
|
|
|
]]>
|
2005-04-24 23:50:58 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
2006-07-11 07:05:04 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="notes">
|
|
|
|
&reftitle.notes;
|
|
|
|
<tip>
|
|
|
|
<para>
|
|
|
|
Timestamp of the start of the request is available in
|
2021-04-24 17:01:17 +00:00
|
|
|
<varname>$_SERVER['REQUEST_TIME']</varname>.
|
2006-07-11 07:05:04 +00:00
|
|
|
</para>
|
|
|
|
</tip>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2005-04-24 23:50:58 +00:00
|
|
|
<para>
|
2006-07-11 07:05:04 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>date</function></member>
|
|
|
|
<member><function>microtime</function></member>
|
|
|
|
</simplelist>
|
2005-04-24 23:50:58 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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"
|
2002-04-15 00:12:54 +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
|
|
|
|
-->
|