Hiya
I wondering if anyone can help me: I am trying to take a user input from a text field $data in the form of dd/mm/yyyy. I then break this down into pieces and use mktime() function to convert into a unix timestamp.
I also create the current date using $today = time(); and convert this also into unix timestamp. Once these two dates (the user input and the current date) have been calculated I want to put them into mysql database.
Now when I do the difference I seem to not get the right amount of days difference? can anyone see what is going wrong:
$estdate = "$date"; //$date is stored from user
$datepieces = explode("/",$estdate);
$month = $datepieces[1];
$day = $datepieces[0];
$year= $datepieces[2];
//validates the data inputed
$valid_date=checkdate($month,$day,$year);
$estimated_date=mktime ("","","",$month, $day, $year);
$today = time();
$difference = $today -$estimated_date1;
$diff_in_days = floor($difference / ( 365 24 60 *60));
echo "The difference in days is $diff_in_days";