On Wed, 21 Aug 2002, Kai Vermehr wrote:

> how can I calculate the difference between two dates in days? I'd like to
> get the days to go between <current_date> and a job-deadline in the future.
>
> thank)s to MySQL
>
> --
> Kai Vermehr
> eBoy Graphics
> http://www.eboy.com

Using a single MySQL select query to give me the date difference, I'd use
something like this:

  SELECT (UNIX_TIMESTAMP('2002-11-12')-UNIX_TIMESTAMP())/86400;

Just performed that query and it gave me '82.96' -- so November 12, 2002
is 82.96 days away.  Of course, you'd substitute 2002-11-12 with something
more meaningful, such as your job-deadline date.

Regards,
Neil Mansilla
whatUseek.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to