Can anyone advise me on how I would go about calculating a date.
Basically I have a number in a variable, and then want to do subtract the number in the integer from the current date and search in SQL using a particular date.
Any ideas?
$numdays = 50;
$date = date('Y-m-d', mktime(0,0,0,date('n'), date('j')-$numdays, date('Y')));
$date now has the date 50 days ago which you can use in your query
hth
Spot on cheers. 😉
here is another way to do it (assuming your using mysql)
SELECT date_sub(curdate(), interval 50 day) as 'alias_name'
That will then take away 50 days from the current date (just as you wanted)
HTH
GM