RE: [PHP] Calendar problem
| From: | John W. Holmes | Date: | Thu, 16 Jan 2003 04:14:20 +0000 |
| Subject: | RE: [PHP] Calendar problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131809@lists.php.net to get a copy of this message | ||
> I have two fields in my form. When two dates are entered in these two
> boxes, I need to find the diiference in calendar months and remaining
days
> between these two dates. This "Calendar months and remaining days" is
> important. The functions that I know do not work for calendar months.
> Can anyone help me and tell me how this could be achieved and are
there
> any PHP functions to do this?
You can use strtotime() (probably) to convert what's entered into a unix
timestamp. From there you know how many seconds are in a day, so a
little math can figure out how many days are between the two dates. You
can use date() to find out the month of each one and do some more
math...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/