<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="intldatepatterngenerator.getbestpattern" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>IntlDatePatternGenerator::getBestPattern</refname>
  <refpurpose>Determines the most suitable date/time format</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="IntlDatePatternGenerator">
   <modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>IntlDatePatternGenerator::getBestPattern</methodname>
   <methodparam><type>string</type><parameter>skeleton</parameter></methodparam>
  </methodsynopsis>
  <para>
   Determines which date/time format is most suitable for a particular locale.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>skeleton</parameter></term>
    <listitem>
     <para>
      The skeleton.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns a format, accepted by <methodname>DateTimeInterface::format</methodname> on success, &return.falseforfailure;.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><methodname>IntlDatePatternGenerator::getBestPattern</methodname> example</title>
    <programlisting role="php">
<![CDATA[
<?php

$skeleton = 'YYYYMMdd';
$today = \DateTimeImmutable::createFromFormat('Y-m-d', '2021-04-24');
 
$patternGenerator = new \IntlDatePatternGenerator('de_DE');
$pattern = $patternGenerator->getBestPattern($skeleton);
echo 'de: ', \IntlDateFormatter::formatObject($today, $pattern, 'de_DE'), "\n";
 
$patternGenerator = new \IntlDatePatternGenerator('en_US');
$pattern = $patternGenerator->getBestPattern($skeleton);
echo 'en: ', \IntlDateFormatter::formatObject($today, $pattern, 'en_US');
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
de: 24.04.2021
en: 04/24/2021
]]>
    </screen>
   </example>
  </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:"~/.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
-->
