PHP Datetime Class setDate

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

setDate sets the date in a DateTime object.

$date = new DateTime();
$date->setDate(2016, 7, 25);

this example sets the date to be the twenty-fifth of July, 2015, it will produce the following result:

2016-07-25 17:52:15.819442


Got any PHP Question?