PHP 8.4.2 Released!

DateTime::setTimestamp

date_timestamp_set

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

DateTime::setTimestamp -- date_timestamp_setSets the date and time based on an Unix timestamp

Descrizione

Stile orientato agli oggetti

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

Stile procedurale

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

Sets the date and time based on an Unix timestamp.

Like DateTimeImmutable::setTimestamp() but works with DateTime.

The procedural version takes the DateTime object as its first argument.

Elenco dei parametri

oggetto

Solo per lo stile procedurale: Un oggetto DateTime restituito da date_create(). La funzione modifica questo oggetto.

timestamp

Unix timestamp representing the date. Setting timestamps outside the range of int is possible by using DateTimeImmutable::modify() with the @ format.

Valori restituiti

Returns the modified DateTime object for method chaining.

Vedere anche:

add a note

User Contributed Notes

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