Reputation: 321
i write the code for adding a 12 weeks to the saturday and stored in a variable,now i want to take another variable to add 1 week for the variable that stored in 12 weeks.i wrote it,but it shows error msg with the "1970/jan/08" date. i write the code as
$month = 2;
$year = 2012;
$saturday = strtotime('First Saturday '.date('F o',
mktime(0,0,0, $month, 1, $year)));
echo date('Y/M/d', $saturday);
echo "<br/>";
$season1 = strtotime ( '+12 week' , $saturday);
$season1= date ( 'Y/M/d' , $season1 );
echo $season1;
echo "<br/>";
echo "<br/>";
$abc = strtotime ('+1 week' , $season1);
$abc = date ('Y/M/d', $abc);
echo "<br/>";
echo $abc;
in $abc variable i got the error.can any one help me to sort out this,thanks in advance
Upvotes: 0
Views: 1258
Reputation: 360752
strtotime()'s second parameter must be a TIME value, e.g. an integer. You're passing in a string here:
$abc = strtotime ('+1 week' , $season1);
^^^^^^^^^----
at the point this is called, $season1 is a string you created with a date()
call here:
$season1= date ( 'Y/M/d' , $season1 );
Upvotes: 2