I have written a sql query to increment 1 year, 10 months, 11 months, and few more date, from the date given. its working fine for every month up to 12th date, when I enter 13th or after 13th date the year will changed to 1971 or 1970. I don't why?
here is my code:
$Domain_Renewal_Date = date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Registered_Date)) ." + 365 day"));
$Alert_Mail_Date= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) ." - 60 day"));
$Alert_Mail_Date1= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 30 day"));
$Alert_Mail_Date2= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 22 day"));
$Alert_Mail_Date3= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 17 day"));
$Alert_Mail_Date4= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 10 day"));
$Alert_Mail_Date5= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 5 day"));
You have set that date to Unix timestamp, so when you are adding a date and overflows the range, it comes back to 1 January 1970, the date set for that format.
The maximum date repesentable with that format is Tuesday 2038-01-19.
I suggest you to change the format of that field.
http://docs.php.net/manual/en/datetime.formats.date.php says
This page describes the different date formats
[...]
American month, day and year mm "/" dd "/" y
So, that's different from your dd/mm/yy format and since mm=13/dd=9/yy=2015 is an invalid date strtotime returns FALSE,
date() expects an integer =>
false->integer=0 =>
date(..., 0) =>
01/01/197[0|1]