php-doc-en/reference/intl/dateformatter/get-pattern.xml

129 lines
3.5 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.5 $ -->
<refentry xml:id="intldateformatter.getpattern" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>IntlDateFormatter::getPattern</refname>
<refname>datefmt_get_pattern</refname>
<refpurpose>Get the pattern used for the IntlDateFormatter</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
Object oriented style
</para>
<methodsynopsis>
<type>string</type><methodname>IntlDateFormatter::getPattern</methodname>
<void />
</methodsynopsis>
<para>
Procedural style
</para>
<methodsynopsis>
<type>string</type><methodname>datefmt_get_pattern</methodname>
<methodparam><type>IntlDateFormatter</type><parameter>fmt</parameter></methodparam>
</methodsynopsis>
<para>
Get pattern used by the formatter.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fmt</parameter></term>
<listitem>
<para>
The formatter resource.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The pattern string being used to format/parse.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>datefmt_get_pattern</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$fmt = datefmt_create( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN ,"MM/dd/yyyy");
echo "pattern of the formatter is : ".datefmt_get_pattern($fmt);
echo "First Formatted output with pattern is ".datefmt_format( $fmt , 0);
datefmt_set_pattern($fmt,'yyyymmdd hh:mm:ss z');
echo "Now pattern of the formatter is : ".datefmt_get_pattern($fmt);
echo "Second Formatted output with pattern is ".datefmt_format( $fmt , 0);
?>
]]>
</programlisting>
</example>
<example>
<title>OO example</title>
<programlisting role="php">
<![CDATA[
<?php
$fmt = new IntlDateFormatter( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN,"MM/dd/yyyy" );
echo "pattern of the formatter is : ".$fmt->getPattern();
echo "First Formatted output is ".datefmt_format( $fmt , 0);
$fmt->setPattern('yyyymmdd hh:mm:ss z');
echo "Now pattern of the formatter is : ".$fmt->getPattern();
echo "Second Formatted output is ".datefmt_format( $fmt , 0);
?>
]]>
</programlisting>
</example>
&example.outputs;
<screen>
<![CDATA[
pattern of the formatter is : MM/dd/yyyy
First Formatted output is 12/31/1969
Now pattern of the formatter is : yyyymmdd hh:mm:ss z
Second Formatted output is 19690031 04:00:00 PST
]]>
</screen>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>datefmt_set_pattern</function></member>
<member><function>datefmt_create</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- 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:"../../../../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
-->