At 09:36 AM 3/10/2003, Anil Garg wrote:
The date field in my database table looks as below:
"07th of March 2003 10:14:29 PM"

Weird. All of my datetime variables look like '2003-03-07 22:14:29'. Are these fields datetime field types or are they text that looks like a date?


If they are datetime, you can just do this:

select * from mytable where (mydate >= date_sub(now(), interval 14 day) and (mydate > now());

This should get you all dates that are more recent than 14 days ago but are not in the future. I'm not 100% sure of the syntax though. Check out http://www.mysql.com/doc/en/Date_and_time_functions.html for more info.

If that is just a string that looks like a date, I'm not sure what you can do using mysql alone. If you were using a scripting language like php or perl, you could do some pre-processing.

Bob





======================================================================
Bob Ramsey                       Applications Development & Support II
ph:  1(319)335-9956                              216 Boyd Law Building
fax: 1(319)335-9019                  University of Iowa College of Law
mailto:[EMAIL PROTECTED]                Iowa City, IA 52242-1113
For Hardware and Software questions, call 5-9124
======================================================================


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