DateTimeInterface::getTimestamp DateTimeImmutable::getTimestamp DateTime::getTimestamp date_timestamp_get Obtiene el timestamp Unix &reftitle.description; &style.oop; public intDateTimeInterface::getTimestamp public intDateTimeImmutable::getTimestamp public intDateTime::getTimestamp &style.procedural; intdate_timestamp_get DateTimeInterfaceobject Obtiene el timestamp Unix. &reftitle.parameters; &no.function.parameters; &reftitle.returnvalues; Devuelve el timestamp Unix que representa la fecha. &reftitle.errors; Si el sello de tiempo no puede ser representado como un &integer;, se lanza una DateRangeError. Anterior a PHP 8.3.0, se lanzaba una ValueError. Y anterior a PHP 8.0.0, se devolvía &false; en este caso. Sin embargo, el sello de tiempo puede ser obtenido como un &string; utilizando DateTimeInterface::format con el formato U. &reftitle.changelog; &Version; &Description; 8.3.0 La excepción de fuera de rango ahora es una DateRangeError. 8.0.0 Estas funciones ya no devuelven &false; en caso de fallo. &reftitle.examples; Ejemplo con <function>DateTime::getTimestamp</function> &style.oop; getTimestamp(); ]]> &example.outputs.similar; &style.procedural; &example.outputs.similar; Para obtener el sello de tiempo con precisión en milisegundos o microsegundos, es posible utilizar la función DateTimeInterface::format. Obtención del sello de tiempo con precisión en milisegundos y microsegundos &style.oop; format('Uv'); // Timestamp en milisegundos $micro = (int) $date->format('Uu'); // Timestamp en microsegundos echo $milli, "\n", $micro, "\n"; ]]> &example.outputs.similar; &reftitle.seealso; DateTime::setTimestamp DateTimeImmutable::setTimestamp DateTimeInterface::format