Can someone give me php code that will check if a date is older than 180 days from today's date? I need it to give a 1 or a 0 if it is or isn't older. Thanks! 🙂
If you have your date as a timestamp its easy:
if ($yourdate<strtotime("-180 days")) echo "yourdate is older than 180 days";
I have it in the format: 2002-12-28 Is there any way to change that to a timestamp?
Ok, heres one:
$yourdate="2002-12-28"; $n=explode("-",$yourdate); $year=$n[0]; $month=$n[1]; $day=$n[2]; $yourdate=mktime (0,0,0,$month,$day,$year); if ($yourdate<strtotime("-180 days")) echo "yourdate is older than 180 days";