Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

date_timestamp_set()

Example

Set the date and time using a Unix timestamp:

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

Definition and Usage

The date_timestamp_set() function sets the date and time according to a Unix timestamp.

Syntax

date_timestamp_set(object, unixtimestamp)

Parameter Values

 

Parameter

Description

object

Required. Specifies a DateTime object returned by date_create(). This function modifies the provided object.

unixtimestamp

Required. Specifies a Unix timestamp that represents the date and time.

Technical Details

Return Value:

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

PHP Version:

5.3+