Hi.

On Mon 2002-11-04 at 15:24:19 -0600, [EMAIL PROTECTED] wrote:
> More appropriately, use curdate()feature from within sql.
> 
> select * where date= < curdate()-1;

Two points:

- How does this relate to the origianl question? He wanted to know how
  to calculate a time interval.

- The above has no reasonable behaviour. If the current date is
  "2002-10-01", you will get 20021000 as result. It's exactly the
  problem I just explained in the mail before.

Regards,

        Benjamin.

[...]
> You may not use +- on timestamps (DATETIME or TIMESTAMP) directly. For
> calculating differences between dates in seconds UNIX_TIMESTAMP() is
> probably the most useful, i.e.
> 
>   UPDATE mytable
>   SET elapsed_seconds = UNIX_TIMESTAMP(time_end) -
> UNIX_TIMESTAMP(time_begin);
> 
> Your method used the numer representation of the dates
> (e.g. 19971231235959) and did an integer substration, which will not
> take into account that seconds and minutes wrap at 60 and so on.
[...]

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
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