PHP date/time help/
- by NOW
I keep getting a value of 0 for $years and $months when there should be a value other then 0 can someone tell me what I'm doing wrong with my code? And what I need to fix?
I'm trying to subtract two dates.
Here is my PHP code.
$delete_date = "2000-01-12 08:02:39";
$current_date = date('Y-m-d H:i:s'); //current date
$diff = abs(strtotime($current_date) - strtotime($delete_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
echo $current_date . '<br />';
echo $delete_date. '<br />';
echo $diff. '<br />';
echo $years. '<br />';
echo $months. '<br />';