Re: Date Comparsion
| From: | Lee Doolan | Date: | Tue, 18 Jun 2002 16:04:50 +0000 |
| Subject: | Re: Date Comparsion | ||
| References: | 1 | Groups: | php.db php.general php.windows |
| Request: | Send a blank email to php-general+get-102723@lists.php.net to get a copy of this message | ||
>>>>> "Jack" == Jack <nedcor4@nedcor.com.hk> writes:
Jack> Dear all I had a form which let user to input the leave_from
Jack> and leave_to date into, the format of the date that user
Jack> input is "yyyy-mm-dd". Now i want to compare the leave_from
Jack> and leave_to date to find out the number of days between!
well, here's one way:
$interval_days= (strtotime($to_date) - strtotime($from_date)) / 3600 * 24
adjust to taste.
--
When the birdcage is open, | donate to causes I care about:
the selfish bird flies away, | http://svcs.affero.net/rm.php?r=leed_25
but the virtuous one stays. |