DateTime::setTimestamp

date_timestamp_set

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

DateTime::setTimestamp -- date_timestamp_setEstablece la fecha y la hora basándose en una marca temporal de Unix

Descripción

Estilo orientado a objetos

public DateTime::setTimestamp(int $timestamp): DateTime

Estilo por procedimientos

date_timestamp_set(DateTime $object, int $timestamp): DateTime

Establece la fecha y la hora basándose en una marca temporal de Unix (Unix timestamp).

Igual que DateTimeImmutable::setTimestamp() pero funciona con DateTime.

La versión procedural toma el objeto DateTime como su primer argumento.

Parámetros

object

Solamente para el estilo por procedimientos: Un objeto DateTime devuelto por date_create(). La función modifica este objeto.

timestamp

La marca temporal de Unix que representa la fecha. Establecer marcas de tiempo fuera del rango de int es posible usando DateTimeImmutable::modify() con el formato @.

Valores devueltos

Returns the modified DateTime object for method chaining.

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top