I have a date stored in an array:
$this->lines['uDate']
The format of the date is not fixed. I can be changed with this:
define('DATETIME_FORMAT', 'y-m-d H:i');
How can I increment my uDate with a certain number of days or years?
My question is related to this one:
increment date by one month
However, in my case the date format in dynamic.
So, can I do this?
$time= $this->lines['uDate'];
$time = date(DATETIME_FORMAT, strtotime("+1 day", $time));
$this->lines['uDate']= $time;
date_add()
and consider changes like:
define(DATETIME_FORMAT, 'y-m-d H:i');
$time = date(DATETIME_FORMAT, strtotime("+1 day", $time));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With