RE: [PHP] Re: Date/Time Query Help
| From: | Shrout, Ryan | Date: | Tue, 24 Jul 2001 20:02:07 +0000 |
| Subject: | RE: [PHP] Re: Date/Time Query Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-59422@lists.php.net to get a copy of this message | ||
When I run: SELECT * FROM session WHERE session.Date > DATE_SUB(NOW(),
INTERVAL 1 HOUR)
I get an empty set, but there are entries that satisfy it.
When I run: select Date from session order by Date desc limit 10
I get:
+---------------------+
| Date |
+---------------------+
| 2001-07-24 04:00:45 |
| 2001-07-24 04:00:40 |
| 2001-07-24 04:00:20 |
| 2001-07-24 03:22:24 |
| 2001-07-24 03:02:25 |
| 2001-07-24 02:53:55 |
| 2001-07-24 02:27:09 |
| 2001-07-24 02:24:54 |
+---------------------+
8 rows in set (0.00 sec)
-----Original Message-----
From: bopolissimus@sni.ph [mailto:bopolissimus@sni.ph]
Sent: Tuesday, July 24, 2001 3:43 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Date/Time Query Help
On Tue, 24 Jul 2001 15:23:10 -0400, Rshrout@krauss-maffeicorp.com
(Ryan Shrout) wrote:
>WHERE session.Date > DATE_SUB(NOW(), INTERVAL 1 HOUR) is equal to:
>
>WHERE 2001-07-24 15:03:24 > SUBTRACTION( 2001-07-24 15:30:21, 00:01:00) =
>WHERE 2001-07-24 15:03:24 > 2001-07-24 14:30:21
i just tested on my box (dialup connection logs, start is the datetime
the subscriber logged on) and when i do:
select login,start,end,secs from log where
secs.start>date_sub(now(),interval 1 hour)
i get (it's after 3AM here... so the set is small):
+----------+---------------------+---------------------+------+
| login | start | end | secs |
+----------+---------------------+---------------------+------+
| costales | 2001-07-25 02:52:35 | 2001-07-25 03:27:54 | 2119 |
| utopia | 2001-07-25 03:19:38 | 2001-07-25 03:19:41 | 3 |
+----------+---------------------+---------------------+------+
works for me. maybe it's a data problem? what version of
mysql are you using? what happens when you do:
select Date from session order by date desc limit 10;
?
tiger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net