Page 1 of 1

recurring date

Posted: Mon Sep 07, 2009 7:01 am
by jyoti.agarwal
hi

i have a problem in recurring date.
i have a table event in which i stored start date,end date and daily,weekly,monthly recurring values if any.
just as in train schedule.
now i want to select all the values which recur at a particular date.
means i select a date from calendar
and query returns all the events of that day if they recurred on that day

Re: recurring date

Posted: Mon Sep 07, 2009 9:07 am
by Eric!
How is the event date/time formatted in your database?

If you are using the standard SQL datetime format YYYY-MM-DD HH:MM:SS

Code: Select all

 $query = "SELECT Event FROM `TABLE` 
        WHERE date>'".$year."-".$month."-".$day." 00:00:00' AND date<'"
        .$year."-".$month."-".$day." 23:59:59' group by Event";
This will select from your "Event" field in TABLE where the "date" field matches the full 24 hour period of the selected $year-$month-$day from 00:00:00 to 23:59:59. You can make another query to join both start date events and reoccuring events.