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.gmdate" xmlns="http://docbook.org/ns/docbook">
|
2005-04-24 23:50:58 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>gmdate</refname>
|
|
|
|
<refpurpose>Format a GMT/UTC date/time</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>string</type><methodname>gmdate</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>format</parameter></methodparam>
|
2011-05-17 23:22:38 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter><initializer>time()</initializer></methodparam>
|
2005-04-24 23:50:58 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Identical to the <function>date</function> function except that
|
2006-07-11 07:05:04 +00:00
|
|
|
the time returned is Greenwich Mean Time (GMT).
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>format</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The format of the outputted date <type>string</type>. See the formatting
|
|
|
|
options for the <function>date</function> function.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
&date.timestamp.description;
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns a formatted date string. If a non-numeric value is used for
|
|
|
|
<parameter>timestamp</parameter>, &false; is returned and an
|
2009-06-26 07:38:42 +00:00
|
|
|
<constant>E_WARNING</constant> level error is emitted.
|
2006-07-11 07:05:04 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<para>
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>5.1.0</entry>
|
|
|
|
<entry>
|
|
|
|
The valid range of a timestamp is typically from Fri, 13 Dec
|
|
|
|
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
|
|
|
|
the dates that correspond to the minimum and maximum values for
|
|
|
|
a 32-bit signed integer). However, before PHP 5.1.0 this range was limited
|
|
|
|
from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>5.1.1</entry>
|
|
|
|
<entry>
|
|
|
|
There are useful <link linkend="datetime.constants">constants</link>
|
|
|
|
of standard date/time formats that can be used to specify the
|
|
|
|
<parameter>format</parameter> parameter.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
2005-04-24 23:50:58 +00:00
|
|
|
<example>
|
2006-07-11 11:44:16 +00:00
|
|
|
<title><function>gmdate</function> example</title>
|
2006-07-11 07:05:04 +00:00
|
|
|
<para>
|
|
|
|
When run in Finland (GMT +0200), the first line below prints "Jan 01
|
|
|
|
1998 00:00:00", while the second prints "Dec 31 1997 22:00:00".
|
|
|
|
</para>
|
2005-04-24 23:50:58 +00:00
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-03-21 15:46:14 +00:00
|
|
|
<?php
|
2003-12-15 16:55:22 +00:00
|
|
|
echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
|
|
|
|
echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
|
2003-03-21 15:46:14 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2005-04-24 23:50:58 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2006-07-11 07:05:04 +00:00
|
|
|
</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>mktime</function></member>
|
|
|
|
<member><function>gmmktime</function></member>
|
|
|
|
<member><function>strftime</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
|
|
|
|
-->
|