X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP date_time_set() Function

PHP Date/Time PHP Date/Time Reference

Example

Set the time:

<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>

Run example »

Definition and Usage

The date_time_set() function sets the time.


Syntax

date_time_set(object,hour,minute,second);

Parameter Description
object Required. Specifies a DateTime object returned by date_create()
hour Required. Specifies the hour of the time
minute Required. Specifies the minute of the time
second Optional. Specifies the second of the time. Default is 0

Technical Details

Return Value: Returns a DateTime object on success. FALSE on failure
PHP Version: 5.2+
Changelog: PHP 5.3.0: Changed the return value from NULL to DateTime


PHP Date/Time PHP Date/Time Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook