afridy
January 18, 2012, 6:13am
1
Hai folks,
assume 18-2-2012 is an employee id expiry date.
i want to alert the management prior to 30 days of expiry of this id.
but below code does not work. pls help me?
$exp_dt=strtotime(“18-2-2012”);
if ($exp_dt == strtotime(“+30 days”)){
echo “This id will going to expire in 30 days”;
}
afridy
January 18, 2012, 6:43am
2
hai folks,
i think i found the solution. feel free to comment on this.
$exp_dt="18-2-2012";
$alert_dt=getdate(strtotime("+31 days"));
$dd=$alert_dt['mday'];
$mm=$alert_dt['mon'];
$yy=$alert_dt['year'];
$alert_dt=$dd . "-" . $mm . "-" . $yy;
if ($exp_dt == $alert_dt){
echo "This id will going to expire in 30 days";
}
Cups
January 18, 2012, 9:50am
3
if(strtotime($exp_date) < strtotime('+ 31 days')){
echo "This id will going to expire in 30 days";
}
Untested, but something like that should work.
I’d personally test that with dates like 6th May vs 5th June to be sure though
afridy
January 18, 2012, 10:16am
4
Cups:
if(strtotime($exp_date) < strtotime('+ 31 days')){
echo "This id will going to expire in 30 days";
}
Untested, but something like that should work.
I’d personally test that with dates like 6th May vs 5th June to be sure though
Thanks for the reply buddy, i got it…