How can I get the value from Date 2 minus Date 1? For example, if Date 1 = 08/19/2007 and Date 2 = 08/19/2009, I want the value to be equal to 2, for 2 years. $domain['date1'] = date('m/d/Y', $domain['date1']); $domain['date2'] = date('m/d/Y', $domain['date2']); $age = $domain['date2'] - $domain['date1']; Here's what I had, but displaying $age shows 0 no matter what.
well, your trying to subtract the number 08/19/2007 that is not a number (slashes) you can get just the year, and subtract them, or you could make it one whole number. Also date goes by 30-31 days, while actual numbers go by base 10. if you were to do 892007 - 8192007 it would be 1 for one year, but if there were 5 days added onto that it would be 5000001, see your problem here?