I am trying to validate input date fields, and I want to make sure that the entires are no more than 90 days difference from each other. Could anyone offer any solutions to the function I need to be using here. Below is my psuedocode of what I want to achieve.
if (($filter_in['dt']-90) > ($filter_in['df']));
The -90
bit is where I need to minus 90 days from the end date. Is it possible to go about this in this approach?
Do like this
<?php
$datetime1 = new DateTime('2012-10-11');
$datetime2 = new DateTime('2012-09-13');
$interval = $datetime2->diff($datetime1);
$diff= $interval->format('%R%a');
if($diff=="+90"){
//your code
}
?>
or in above code you can just format like this
$diff= $interval->format('%a');
or simply like @vascowhite said
$diff= $interval->days;
to get a positive integer only, the above code returns 28
which is in days.