Urgent! PHP Date Question

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”;
}

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";
}

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

Thanks for the reply buddy, i got it…