PHP date_timestamp_set() Function

Example

Set date and time based on Unix timestamp:

<?php
$date=date_create();
date_timestamp_set($date,1472988263);
echo date_format($date,"U = Y-m-d H:i:s");
?>

Running Instance

Definition and Usage

date_timestamp_set() function sets the date and time based on Unix timestamp.

Syntax

date_timestamp_set(object,unixtimestamp);
Parameter Description
object Required. Specifies by date_create() Returns the DateTime object. This function modifies the object.
unixtimestamp Required. Specifies the Unix timestamp representing the date.

Technical Details

Return Value: Returns the modified DateTime object. If failed, returns FALSE.
PHP Version: 5.3+