ConFoo Montreal 2026: Call for Papers

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

Description

Object-oriented style

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

Procedural style

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.

Parameters

object

Procedural style only: A DateTime object returned by date_create(). The function modifies this object.

timestamp

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

Return Values

Returns the modified DateTime object for method chaining.

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy