note 92163 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 14 Dec 2014 11:33:32 +0000 |
| Subject: | note 92163 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-201164@lists.php.net to get a copy of this message | ||
Note Submitter: nan at ladyslipperwebs dot com
----
A great little function to see if dates chosen are more than three months apart and if they are,
change the end date to three months from the begin date. This is easy to change.
<?php
function daysDifference($endDate, $startDate)
{
$startTS = strtotime($startDate);
$endTS = strtotime($endDate);
$maxTS = strtotime($startDate.' + 3 months');
if($endTS > $maxTS) {
$endTS = $maxTS;
}
$endDate = date('Y-m-d', $endTS);
return $endDate;
}
?>