note 92163 added to function.strtotime

From: Date: Sun, 12 Jul 2009 11:27:55 +0000
Subject: note 92163 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-158197@lists.php.net to get a copy of this message
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. 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; } ---- Server IP: 208.69.120.35 Probable Submitter: 141.154.114.42 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/92163 Del: integrated -- https://master.php.net/note/delete/92163/integrated Del: useless -- https://master.php.net/note/delete/92163/useless Del: bad code -- https://master.php.net/note/delete/92163/bad+code Del: spam -- https://master.php.net/note/delete/92163/spam Del: non-english -- https://master.php.net/note/delete/92163/non-english Del: in docs -- https://master.php.net/note/delete/92163/in+docs Del: other reasons-- https://master.php.net/note/delete/92163 Reject -- https://master.php.net/note/reject/92163 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158197) next »