Re: Within the date format
| From: | Miguel Cruz | Date: | Fri, 19 Apr 2002 15:43:31 +0000 |
| Subject: | Re: Within the date format | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93720@lists.php.net to get a copy of this message | ||
On Fri, 19 Apr 2002, Ron Allen wrote:
> This is what I have right now
>
> $totaltime= date(":H:i:s", mktime(0,0,$totaltime));
>
> This is the result
>
> 04:20:46
>
> from the following dates
> 2002-04-25 16:30:16
> 2002-04-19 12:09:30
> 534046 seconds
>
> I would like to be able to get the days and, if needed, the number of months
> and years
Well, I think the easiest way is going to be to split your date apart into
$day, $month, $year and then subtract.
You can't just do a cascading modulus calculation on the delta between the
timestamps, because that won't take leap years into account.
miguel