Categories
PHP

Calculate date with date now and period defined in PHP? [on hold]

How to calculate from the date of now and a defined time (two months), the date of departure ?

$date = new \DateTime('now'); // ["date"] = 2018-04-18 11:22:55.213281
$twoMonths = 2;

For exemple :

2018-04-18 11:22:55.213281 – 2 months = 2018-02-18 11:22:55.213281

Leave a comment