storing recurring dates
Hi, I'm doing an event project and some of the events will be reccuring. For example: Monday, Wednesday, Friday from 10-11:30 am starting June 1 with no end date Every third Monday at 3-4 pm starting July 1 and ending January 1 (last event is third Monday in December) Every other Friday starting at 1pm with no set end time, starting June 3 Is there a good way to store those in a mysql database? So far the only thing I can think of is that on entry, have a script figure out all of the dates, which is pretty easy in php. Then for the events with no end date set an arbitrary end date of 5 years in the future knowing that the technology will probably change by then and the app will need to be re-written. Is there maybe some way or combination with the php strtotime function? I know it can take something like Third Thursday of October and turn it into a unix time stamp. But my brain is just not working today. ;) Thanks, Bob -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: storing recurring dates
Bob, You should check out the Date::Manip module from CPAN, it will do what you need to do. Here is a snippet from the docs about recurrence: RECURRENCE A recurrence is simply a notation for defining when a recurring event occurs. For example, if an event occurs every other Friday or every 4 hours, this can be defined as a recurrence. With a recurrence and a starting and ending date, you can get a list of dates in that period when a recurring event occurs. This should get you going with all the options you need. Chris Hood -Original Message- From: Ramsey, Robert L [mailto:[EMAIL PROTECTED] Sent: Sunday, June 12, 2005 8:51 AM To: mysql@lists.mysql.com Subject: storing recurring dates Hi, I'm doing an event project and some of the events will be reccuring. For example: Monday, Wednesday, Friday from 10-11:30 am starting June 1 with no end date Every third Monday at 3-4 pm starting July 1 and ending January 1 (last event is third Monday in December) Every other Friday starting at 1pm with no set end time, starting June 3 Is there a good way to store those in a mysql database? So far the only thing I can think of is that on entry, have a script figure out all of the dates, which is pretty easy in php. Then for the events with no end date set an arbitrary end date of 5 years in the future knowing that the technology will probably change by then and the app will need to be re-written. Is there maybe some way or combination with the php strtotime function? I know it can take something like Third Thursday of October and turn it into a unix time stamp. But my brain is just not working today. ;) Thanks, Bob -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: storing recurring dates
hi, have you tried to hack something with week, month and weekofyear ? there is an interesting url at http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html be aware that the week begins on sunday. mysql select weekofyear('2005-01-02'); +--+ | weekofyear('2005-01-02') | +--+ | 53 | +--+ 1 row in set (0.00 sec) mysql select weekofyear('2005-01-03'); +--+ | weekofyear('2005-01-03') | +--+ |1 | +--+ you can then construct a week-based calendar for the events. hope that helps. Mathias Selon [EMAIL PROTECTED]: Bob, You should check out the Date::Manip module from CPAN, it will do what you need to do. Here is a snippet from the docs about recurrence: RECURRENCE A recurrence is simply a notation for defining when a recurring event occurs. For example, if an event occurs every other Friday or every 4 hours, this can be defined as a recurrence. With a recurrence and a starting and ending date, you can get a list of dates in that period when a recurring event occurs. This should get you going with all the options you need. Chris Hood -Original Message- From: Ramsey, Robert L [mailto:[EMAIL PROTECTED] Sent: Sunday, June 12, 2005 8:51 AM To: mysql@lists.mysql.com Subject: storing recurring dates Hi, I'm doing an event project and some of the events will be reccuring. For example: Monday, Wednesday, Friday from 10-11:30 am starting June 1 with no end date Every third Monday at 3-4 pm starting July 1 and ending January 1 (last event is third Monday in December) Every other Friday starting at 1pm with no set end time, starting June 3 Is there a good way to store those in a mysql database? So far the only thing I can think of is that on entry, have a script figure out all of the dates, which is pretty easy in php. Then for the events with no end date set an arbitrary end date of 5 years in the future knowing that the technology will probably change by then and the app will need to be re-written. Is there maybe some way or combination with the php strtotime function? I know it can take something like Third Thursday of October and turn it into a unix time stamp. But my brain is just not working today. ;) Thanks, Bob -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]