I have a date stored in this format, MM/DD/YYYY so 11/17/2010.
How can I write code to test if another date is within one month previous to that date?
I have a date stored in this format, MM/DD/YYYY so 11/17/2010.
How can I write code to test if another date is within one month previous to that date?
Do you need a PHP code or you want to perform a database query? All databases support DATE type and have a set of functions to work with it.
$base = strtotime('11/17/2010');// you retrieve timestamp of your string date
$oneMonthAgo = strtotime('-1 month',$base); //you retrieve timestamp of one month previous date
then you can retrieve another date in timestamp and compare
Thank you very much.