Jump to content

strtotime ?/help


bootes

Recommended Posts

First time posting code and very new to php aka learning as I go...

 

The below code works as shown, but in the 'else' clause, I'd like to replace the +4 with

a variable.  How to do this?

 

I've tried,

 

$renewaldate = strtotime($subscriptiondate);

$sft = "' +" . $duesmultiplier . " year'";
$next_year = date('Y-m-d',strtotime($sft,$renewaldate));

 

but this doesn't return what I expect.  Perhaps this can't be done using this

technique?

 

if($n == 0)
{
$renewaldate = strtotime($subscriptiondate);
$next_year = date('Y-m-d',strtotime('next year',$renewaldate));
echo $next_year;
}
else
{ 
$renewaldate = strtotime($subscriptiondate);
$next_year = date('Y-m-d',strtotime('+4 year',$renewaldate));
echo $next_year;
}

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/254671-strtotime-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.