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
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

 

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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));

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.