Closed (fixed)
Project:
Date
Version:
5.x-2.3
Component:
Date API
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 Oct 2008 at 05:35 UTC
Updated:
14 Nov 2008 at 15:32 UTC
I need a way to find the next XXXday after a given date. In some cases, I will need to chain/increment the results in order to fill an array or table. For example, an array might contain these values:
-The first Tuesday after today
-The first Thursday after that
-The first Tuesday after that
-The first Thursday after that
-The first Saturday after that
-The first Monday after that
-etc.
How can I do this using the API? I've gone over the docs and this issue queue without finding anything similar. Am I blind, or obtuse? HELP!
Thanks. I sure hope this isn't impossible.
Comments
Comment #1
karens commentedThat's how to do an erratic pattern. If you had a repeating pattern, you could also use the Date Repeat API, like:
$rrule is an iCal RRULE, like 'RRULE:FREQ=DAILY;BYDAY=1TU,1TH";
$start_date is a start date for the repeats, in the format YYYY-MM-DD HH:MM:SS.
$end_date is and end date for the repeats, in the same format.
$exceptions is a comma-separated list of dates that are exceptions to the rule. Exceptions are formatted 'YYYY-MM-DD'.
It returns an array of dates that match the rule.
Comment #2
rconstantine commentedThanks so much. Is this: http://www.kanzaki.com/docs/ical/rrule.html the best source of info on RRULES, or is there a better link that you have? You saved my bacon here. Awesome module. Really impressive.
Comment #3
karens commentedYes, that's a good link. I used that to come up with the examples in the test suite.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.