Jump to content

Need some date expiration help please


nocniagenti

Recommended Posts

I have memberships where expiration format date is as follows

 

Your membership will expire on  05/15/2009

 

code to output is

 

print "Your membership will expire on " . date('m/d/Y', strtotime($expire));

 

where $expire is being pulled from session that has the data ,

 

what I need is

 

some math to remind user to renew membership or show renew link, 10 or 15 days before membership expires.

 

something like

 if($expire < 10days){
echo 'Renew link';
}

 

Any help is appreciated

 

 

Link to comment
https://forums.phpfreaks.com/topic/150766-need-some-date-expiration-help-please/
Share on other sites

I would do this

if(date("Y-m-d", strtotime("+10 days"))==date("Y-m-d", strtotime($expire)))  { 
echo 'Renew Link'; 
}

or +15 days

I have memberships where expiration format date is as follows

 

Your membership will expire on  05/15/2009

 

code to output is

 

print "Your membership will expire on " . date('m/d/Y', strtotime($expire));

 

where $expire is being pulled from session that has the data ,

 

what I need is

 

some math to remind user to renew membership or show renew link, 10 or 15 days before membership expires.

 

something like

 if($expire < 10days){
echo 'Renew link';
}

 

Any help is appreciated

 

Does not work , tried both , this is second snipet ,

user expire set to

 

3-25-09

foreach ($_SESSION['_getsubscription'] as $p){
if ($p['completed']) $expire = $p['expire_date'];

}
if(date("m-d-Y", strtotime("+10 days"))==date("m-d-Y", strtotime($expire)))  {
echo 'Renew NOW';
}else{
print "Your membership will expire on " . date('m-d-Y', strtotime($expire));
}

 

I get

 

Your membership will expire on 03-25-2009 

Just before the if state put this

echo "10 Days from now: ".date("m-d-Y",strtotime(+10 Days))."<br>"; 
echo "Expiration Date: ".$expire; 

to make sure that the expiration date variable is 10 days or 15 days whichever you're using, from today and that they're the same format. 

 

 

Does not work , tried both , this is second snipet ,

user expire set to

 

3-25-09

foreach ($_SESSION['_getsubscription'] as $p){
if ($p['completed']) $expire = $p['expire_date'];

}
if(date("m-d-Y", strtotime("+10 days"))==date("m-d-Y", strtotime($expire)))  {
echo 'Renew NOW';
}else{
print "Your membership will expire on " . date('m-d-Y', strtotime($expire));
}

 

I get

 

Your membership will expire on 03-25-2009 

for

 

Expiration Date: 2009-03-25

 

Your membership will expire on 2009-25-03

 

and

 

 

echo "10 Days from now: ".date("m-d-Y",strtotime(+10 Days));

 

is giving me

 

syntax error, unexpected T_STRING in

line 53 which is

 

echo "10 Days from now: ".date("m-d-Y",strtotime(+10 Days));

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.