PHP date_timestamp_set() function

P
PHP date_sunrise() function
PHP date_timezone_get() function

In this article, you will learn how to set the date and time in PHP according to the UNIX timestamp. The date_timestamp_set() function accepts the UNIX timestamp and sets the corresponding Date and Time in the result.

What is the syntax of the date_timestamp_set() function in PHP?

date_timestamp_set(object, unixtimestamp)
ParameterDescription
objectRequired. Specifies a DateTime object returned by date_create(). This function modifies this object
unixtimestampRequired. Specifies a Unix timestamp representing the date
PHP date_timestamp_set() method

Examples of the date_timestamp_set() function

Example 1.

<?php
$d=date_create();
date_timestamp_set($d,1261702212);
echo date_format($d,"U = Y-m-d H:i:s");
?>
PHP date_sunrise() function
PHP date_timezone_get() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z