You can use NOW() to get the current timestamp:

mysql> select NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2001-10-18 12:49:29 |
+---------------------+

But it would be easier to let MySQL calculate the elapsed time:

select 
IF(TIME_TO_SEC(NOW()) - TIME_TO_SEC(logged_ts) > 300, 'true', 'false') 
from <table>;

where logged_ts is your logged timestamp and <table> is the name of your
table.. 

/torgil

> Hi all
> I'm having a problem getting a query to work where I want to compare
the
> current_timestamp to the logged timestamp, and return false if less
than
> 300
> seconds, can you tell me if it is possible to have the current
timestamp
> returned as part of a query, so as I can then do my calculations in my
> script.
> Thanks
> Paul
> 
> 
> ---------------------------------------------------------------------
> 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 <mysql-unsubscribe-
> [EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



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