RE: [PHP-DB] Date Ranges

From: Date: Thu, 03 May 2001 00:03:28 +0000
Subject: RE: [PHP-DB] Date Ranges
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9070@lists.php.net to get a copy of this message
if you have a table with a date field, you can write a query that will look something like this: // assuming these dates $start_date = '2001-02-05'; $end_date = '2001-07-05'; // sql query SELECT * FROM events_table WHERE date_field >= '$start_date' AND date_field <= '$end_date'; this would result in all events starting Feb 02, 20001 and ending July 05, 2001 depending on your requirements you can use the following comparison operators: for $start_date: = equal to >= Greater than or equal to > Greater than for $end_date: = equal to <= less than or equal to < less than Hope this helps. -----Original Message----- From: Mike Baerwolf [mailto:mike@wkla.com] Sent: Wednesday, May 02, 2001 5:11 PM To: php-db@lists.php.net Subject: [PHP-DB] Date Ranges Hi, I'm working on a event calendar and some events span more than one day. I would like to store a date range like 2001-02-05 thru 2001-07-05 so when I do a query for the current day the event would appear for all the days in the range. I hoping someone can point me to some documentation or tutorials on this. Thanks in advance, Mike

« previous php.db (#9070) next »