RE: [PHP-DB] Dates

From: Date: Fri, 25 Aug 2000 20:25:01 +0000
Subject: RE: [PHP-DB] Dates
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2383@lists.php.net to get a copy of this message
I'm assuming that your date information is stored as the CHAR column type. If so, you could use this query or something similar: SELECT * FROM table WHERE date like '08/25/2000' However, I wouldn't recommend that you rely on that method, because one typo in the date field and your results are bad. A better method would be to convert the date field to the date or datetime column type. That way you can run conditional queries with the date as a criterion: SELECT * FROM table WHERE date = '2000-08-25' Using the DATETIME column type also gives you much more flexibility in the future. For example, to search for all records from July: SELECT * FROM table WHERE date >= '2000-07-01' AND date <= '2000-07-31' -----Original Message----- From: Chris Hughes [mailto:Chris@ecomshare.com] Sent: Friday, August 25, 2000 12:56 PM To: PHP DB Subject: [PHP-DB] Dates Hi, For purposes that are sort of silly I put dates into a mysql tables in the format (m/d/yyy). I have a script that pulls them out based on the unique field in that table. However, now the client doesn't want the listings to show that are older than the current date. Does anyone have any clue as to how I can do this? Thanks in advance Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#2383) next »