List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 17 2002 5:50pm
Subject:Re: NOW()-TIMESTAMP does not return accurate results
View as plain text  
At 23:39 -0800 12/16/02, Troy Kruthoff wrote:
>  >Description:
>   Invalid reporting of date calc         
>>How-To-Repeat:
>   note: SESSIONTS is TIMESTAMP type
>
>   SELECT (NOW()-SESSIONTS) FROM WEBSESSIONS;

What leads you to expect that this should yield any useful result?

>+-------------------+
>| (NOW()-SESSIONTS) |
>+-------------------+
>|              1261 |
>+-------------------+
>1 row in set (0.00 sec)
>
>mysql> SELECT (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(SESSIONTS)) FROM
>WEBSESSIONS;                             
>+---------------------------------------------------+
>| (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(SESSIONTS)) |
>+---------------------------------------------------+
>|                                               748 |
>+---------------------------------------------------+
>1 row in set (0.00 sec)       
>
>>Fix:
>   Cast fields as UNIX_TIMESTAMP to get valid seconds between to periods.

Thread
NOW()-TIMESTAMP does not return accurate resultsTroy Kruthoff17 Dec
  • re: NOW()-TIMESTAMP does not return accurate resultsEgor Egorov17 Dec
  • Re: NOW()-TIMESTAMP does not return accurate resultsPaul DuBois17 Dec
RE: NOW()-TIMESTAMP does not return accurate resultsPaul DuBois19 Dec