I have a variable called $effectiveDate
containing the date 2012-03-26.
I am trying to add three months to this date and have been unsuccessful at it.
Here is what I have tried:
$effectiveDate = strtotime("+3 months", strtotime($effectiveDate));
and
$effectiveDate = strtotime(date("Y-m-d", strtotime($effectiveDate)) . "+3 months");
What am I doing wrong? Neither piece of code worked.
1340649000
as answer, which seems to be correct. – Copyboy$effectiveDate
stores what you think it stores? It works for me. – Brentdate('Y-m-d', 1340661600)
gives2012-06-26
which IS correct. – Pursuancestrtotime
.The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp.
– Billen