DateTimeInterface::getTimestamp
DateTimeImmutable::getTimestamp
DateTime::getTimestamp
date_timestamp_get
Gets the Unix timestamp
&reftitle.description;
&style.oop;
public intDateTimeInterface::getTimestamp
public intDateTimeImmutable::getTimestamp
public intDateTime::getTimestamp
&style.procedural;
intdate_timestamp_get
DateTimeInterfaceobject
Gets the Unix timestamp.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns the Unix timestamp representing the date.
&reftitle.errors;
If the timestamp cannot be represented as &integer;, a ValueError
is thrown. Prior to PHP 8.0.0, &false; was returned in this case.
Still, the timestamp can be retrieved as &string; by using
DateTimeInterface::format with the U format.
&reftitle.changelog;
&Version;
&Description;
8.0.0
These functions no longer return &false; on failure.
&reftitle.examples;
DateTime::getTimestamp example
&style.oop;
getTimestamp();
?>
]]>
&style.procedural;
]]>
&examples.outputs.similar;
&reftitle.seealso;
DateTime::setTimestamp
DateTime::format