SQL Date
Moderator: General Moderators
-
glennalmeda
- Forum Newbie
- Posts: 14
- Joined: Mon Jan 26, 2004 9:00 pm
SQL Date
What is the SQL Statement for searching a record in between two dates? Thank You!
I could be wrong on this, but I think the only SQL99 way to do it is with BETWEEN.
i.e.
$start_date and $end_date need to be in the proper format for your date column (YYYYMMDD for date type columns).
Most databases have special functions for working with dates. Here is a list of the ones for MySQL.
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
-Jackson
i.e.
Code: Select all
SELECT date FROM table WHERE date BETWEEN '$start_date' AND '$end_date'Most databases have special functions for working with dates. Here is a list of the ones for MySQL.
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
-Jackson