X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP date_date_set() Function

PHP Date/Time PHP Date/Time Reference

Example

Return a new DateTime object, set a new date, and then format the date:

<?php
$date=date_create();
date_date_set($date,2020,10,30);
echo date_format($date,"Y/m/d");
?>

Run example »

Definition and Usage

The date_date_set() function sets a new date.


Syntax

date_date_set(object,year,month,day);

Parameter Description
object Required. Specifies a DateTime object returned by date_create()
year Required. Specifies the year of the date
month Required. Specifies the month of the date
day Required. Specifies the day of the date

Technical Details

Return Value: Returns a new DateTime object on success. FALSE on failure
PHP Version: 5.2+
Changelog: From PHP 5.3+; changed the return value from NULL to DateTime (on success)


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

SHARE THIS PAGE

facebook