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");
?>

Run Example

Definition and Usage

date_timestamp_set() Function Sets Date and Time Based on Unix Timestamp.

Syntax

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

Technical Details

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