I have a script that i want to alter to count how many months old something is rather than days, at the moment its going by days old > 6 rather than months.. this is what i got but i dont know how to alter it :
<?
//get last event date and now date
$GetDate = mysql_query("SELECT DATEDIFF(NOW(), FieldUpdate) AS MonthsOld FROM countries
WHERE CountryID='1'")
or die(mysql_error());
$monthsoldrow = mysql_fetch_assoc($GetDate);
//if its been 6 months echo the secret button
If ($monthsoldrow >6){
Echo'
<input type="submit" id="Button1" name="Button1" value="Update" style="position:absolute;left:667px;top:180px;width:75px;height:24px;z-index:20">
';
}
?>
One issue is how you define "months old". Do you count it as from the day in one month to the same day in the other month? In other words, if the first date was July 31 and the second date was Feb. 28, would that be 6 or 7 months?? Or do you count it as the difference in days to the nearest month?? Or do you count it as the number of full months between two dates?? You might have to write a custom function to give you such a result.