<?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 => 'ja',
  ),
  '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' => 'ja',
    '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">
   <code class="parameter">datetime</code> に NULLバイトが含まれている場合は、
   <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> がスローされます。
  </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>
       <code class="parameter">datetime</code> に NULLバイトが含まれている場合は、
       <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> がスローされるようになりました。
       これより前のバージョンでは、こうした値は静かに無視されていました。
      </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); ?>