Calculating the difference betweek two dates
Posted: Mon May 15, 2006 6:35 am
Hi,
I am trying to calculate the numbe rof days between today's date and a future date, for end dates on evaluation software.
Here is my code;
The problem I have with the above is that the $daysleft shows the dates with decimal places, and they are not correct.
Please help
I am trying to calculate the numbe rof days between today's date and a future date, for end dates on evaluation software.
Here is my code;
Code: Select all
// Database query
$sql = mysql_query("SELECT * FROM software WHERE trial = 'YES'");
$row = mysql_fetch_array($sql);
// Set variable $today to today's date
$today = date("Y-m-d"); // Set today's date as variable
//set date two variable to the field value of end_date from the query
$datetwo = $row['end_date'];
// Set variable for number of evaluation days left
$daysleft = ((strtotime($datetwo) - strtotime($today))/86400);Please help