DateTimeInterface::getTimestamp
DateTimeImmutable::getTimestamp
DateTime::getTimestamp
date_timestamp_get
Unix タイムスタンプを取得する
&reftitle.description;
&style.oop;
public intDateTimeInterface::getTimestamp
public intDateTimeImmutable::getTimestamp
public intDateTime::getTimestamp
&style.procedural;
intdate_timestamp_get
DateTimeInterfaceobject
Unix タイムスタンプを取得します。
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
その日付をあらわす Unix タイムスタンプを返します。
&reftitle.errors;
タイムスタンプが数値型として解釈できない場合、
ValueError がスローされます。
PHP 8.0.0 より前のバージョンでは、この場合 &false; を返していました。
DateTimeInterface::format を
U フォーマットと共に使うと、
タイムスタンプを文字列で取得できます。
&reftitle.changelog;
&Version;
&Description;
8.0.0
これらの関数は、失敗時に &false; を返さなくなりました。
&reftitle.examples;
DateTime::getTimestamp の例
&style.oop;
getTimestamp();
?>
]]>
&style.procedural;
]]>
&examples.outputs.similar;
&reftitle.seealso;
DateTime::setTimestamp
DateTime::format