Hi all,
How to compare the two dates...? See my code
i got
1. cur date is 2009-08-22 - pre date is empty for first loop
2. cur date is 2009-08-23 - pre date is 2009-08-22
3. cur date is 2009-08-24 - pre date is 2009-08-23
4. cur date is 2009-08-25 - pre date is 2009-08-24
What i did i checked current record and previous record dates whether they are same or not for whole result (say have ten records).
but the if condtion is not work for date even am checked with < and > conditions but not get succeed.
And also tried with strtotime option... when am using this function to both pdate and $cdate varibales its working only $cdate value, $pdate returns only empty value.. i don't know why...
Any body help me>>>
How to compare the two dates...? See my code
Code:
while(list($cdate)=mysql_fetch_array($res))
{
echo "$i.cur date is ".$cdate;
if($pdate==$cdate)
echo "previous record date and current record date is same";
}
else
{
echo "not same":
}
echo "- date pre is ". $pdate=$cdate;
echo "<br>";
$i++
}
1. cur date is 2009-08-22 - pre date is empty for first loop
2. cur date is 2009-08-23 - pre date is 2009-08-22
3. cur date is 2009-08-24 - pre date is 2009-08-23
4. cur date is 2009-08-25 - pre date is 2009-08-24
What i did i checked current record and previous record dates whether they are same or not for whole result (say have ten records).
but the if condtion is not work for date even am checked with < and > conditions but not get succeed.
And also tried with strtotime option... when am using this function to both pdate and $cdate varibales its working only $cdate value, $pdate returns only empty value.. i don't know why...
Any body help me>>>
Comment