Re: comparing time
| From: | Miguel Cruz | Date: | Wed, 24 Apr 2002 15:17:17 +0000 |
| Subject: | Re: comparing time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94392@lists.php.net to get a copy of this message | ||
On Wed, 24 Apr 2002, Cosmin wrote:
> How can I compare time? So I have to check a difference of 12 or 24 hours
> this mean I have to compare the time between the days too..
>
> How I can make this comparing
> just comparing hour with hou and then minute with minute or is possible
> all of them at the same time?
As long as you don't care about any units larger than days (months and
years are variable-length and thus a little more work), you can just
calculate the difference between two unix timestamps. They're just an
integer number of seconds. Subtract the two, divide by 60 for minutes,
3600 for hours, or 86400 for days.
miguel