<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.datetime.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'datetime.createfromformat.php',
    1 => 'DateTime::createFromFormat',
    2 => 'Разбирает строку времени по заданному формату',
  ),
  'up' => 
  array (
    0 => 'class.datetime.php',
    1 => 'DateTime',
  ),
  'prev' => 
  array (
    0 => 'datetime.construct.php',
    1 => 'DateTime::__construct',
  ),
  'next' => 
  array (
    0 => 'datetime.createfromimmutable.php',
    1 => 'DateTime::createFromImmutable',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/datetime/datetime/createfromformat.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="datetime.createfromformat" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTime::createFromFormat</h1>
  <h1 class="refname">date_create_from_format</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DateTime::createFromFormat</span> -- <span class="refname">date_create_from_format</span> &mdash; <span class="dc-title">
   Разбирает строку времени по заданному формату
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetime.createfromformat-description">
  <h3 class="title">Описание</h3>
  <p class="para">Объектно-ориентированный стиль</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>DateTime::createFromFormat</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$format</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$datetime</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span></span> <code class="parameter">$timezone</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">Процедурный стиль</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><a href="function.date-create-from-format.php" class="methodname">date_create_from_format</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$format</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$datetime</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span></span> <code class="parameter">$timezone</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Метод возвращает новый объект DateTime,
   который представляет строку даты и времени <code class="parameter">datetime</code>
   в формате <code class="parameter">format</code>.
  </p>
  <p class="para">
   Метод работает аналогично методу <span class="methodname"><a href="datetimeimmutable.createfromformat.php" class="methodname">DateTimeImmutable::createFromFormat()</a></span>
   и функции <span class="function"><a href="function.date-create-immutable-from-format.php" class="function">date_create_immutable_from_format()</a></span>,
   но создаёт объект <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span>.
  </p>

  <p class="para">
   Этот метод, включая параметры, примеры и рекомендации, описывает
   страница метода <a href="datetimeimmutable.createfromformat.php" class="link">DateTimeImmutable::createFromFormat</a>.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-datetime.createfromformat-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   Смотрите параметры и их описание на странице метода <a href="datetimeimmutable.createfromformat.php" class="link">DateTimeImmutable::createFromFormat</a>.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetime.createfromformat-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Метод возвращает новый экземпляр класса DateTime или <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, если возникла ошибка.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-datetime.createfromformat-errors">
  <h3 class="title">Ошибки</h3>
  <p class="para">
   Метод выбрасывает исключение <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span>,
   если параметр <code class="parameter">datetime</code> содержит NULL-байты.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-datetime.createfromformat-changelog">
  <h3 class="title">Список изменений</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версия</th>
      <th>Описание</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.21, 8.1.8, 8.2.0</td>
      <td>
       Теперь метод выбрасывает исключение <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span>,
       если в параметр <code class="parameter">datetime</code> передали NULL-байты,
       что раньше метод без предупреждения игнорировал.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-datetime.createfromformat-examples">
  <h3 class="title">Примеры</h3>
  <p class="para">
   Подробный набор примеров смотрите на странице метода
   <a href="datetimeimmutable.createfromformat.php" class="link">DateTimeImmutable::createFromFormat</a>.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-datetime.createfromformat-seealso">
  <h3 class="title">Смотрите также</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="datetimeimmutable.createfromformat.php" class="function" rel="rdfs-seeAlso">DateTimeImmutable::createFromFormat()</a> - Разбирает строку времени по заданному формату</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>