Re: Date Subtraction
| From: | Kurt Lieber | Date: | Wed, 07 Nov 2001 20:55:35 +0000 |
| Subject: | Re: Date Subtraction | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73795@lists.php.net to get a copy of this message | ||
If you're just trying to calculate the difference between two dates, MySQL
doesn't need to (nor should it) be involved at all. It adds unecessary
overhead and complexity.
Look at the time(), mktime() and date() functions in the PHP manual. Those
allow you to create, manipulate and format UNIX timestamps, which will allow
you to produce the results you're looking for.
Also, you might check hotscripts.com or any of the other major PHP sites as I
imagine someone has already created a function to do just what you're looking
for.
--kurt
On Wednesday 07 November 2001 12:37 pm, Dan Tappin wrote:
> I need to get a days, hours, minutes, seconds difference between two dates.
> I have seen in the archives that MySQL is the way to go here. I took a
> shot at the examples and they make sense. The problem is that all of these
> are for a fixed date or the system date minus 1 day or 5 hours etc. I need
> the difference between now and a future date i.e. a countdown type of
> result.