HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

date_timestamp_set

Description

The date_timestamp_set of Date / Time for PHP sets the date and time based on an Unix timestamp.

Syntax

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

Parameters

object

A DateTime object returned by date_create(). The function modifies this object.

timestamp

Unix timestamp representing the date.

Return

Returns the DateTime object for method chaining or FALSE on failure.

Examples

1 · object timestamp

<?

$object = date_create();
$timestamp = date_timestamp_get($object);

date_timestamp_set($object, $timestamp);

echo date_format($object, "U = Y-m-d H:i:s");
1733597911 = 2024-12-07 18:58:31

2 · Return

<?

$object = date_create();
$timestamp = date_timestamp_get($object);

$return = date_timestamp_set($object, $timestamp);

echo date_format($return, "U = Y-m-d H:i:s");
1733597912 = 2024-12-07 18:58:32