Re: Dates
| From: | 1LT John W. Holmes | Date: | Tue, 28 May 2002 18:26:19 +0000 |
| Subject: | Re: Dates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99524@lists.php.net to get a copy of this message | ||
PHP way:
Use strtotime() to get a unix timestamp for each one. subtract smaller from
larger and divide by number of seconds in a day.
MySQL way:
I assume these dates come from a database. Use a query like this:
SELECT TO_DAYS(column_one) - TO_DAYS(column_two) AS Difference FROM table
WHERE ...
Then you'll have a column 'Difference' in your result that contains the
difference between the two dates in days.
---John Holmes...
----- Original Message -----
From: "Jeroen Timmers" <maillist@start4me.nl>
To: <php-general@lists.php.net>
Sent: Tuesday, May 28, 2002 2:16 PM
Subject: [PHP] Dates
> i have two dates
>
> for example
>
> 2002-10-9 and 2002-11-16
>
> Is there a function to see how many day's between thore date's is?
>
> Jeroen
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>