parsing the rec_type value

hi,
i need to parse the rec_type value for inserting to db.

parsing the rec_type is a little complicated for me to understand.

[code]type of recurring encoded in string [type][count][count2][day][days]#[extra]

type - type of repeating “day”,”week”,”week”,”month”,”year”
count - how much intervals of “type” come between events
count2 and day - used to define day of month ( first Monday, third Friday, etc )
days - comma separated list of affected week days
extra - this info is not necessary for calculation, but can be used to correct presentation of recurring details[/code]

could you explain me this: month_1_1_1_#no

and could you give me a tip for parsing this value.

thnx in advance.

month_1_1_1_#no

month_1 - each month
_1 - first
_1 - monday
#no - has not end date

So event will occur montly, on first monday of month.

what if month_21_1#no what changes?

month_2 - each two month

basically thirs group gives the basic period of recurring

week_3 - each 3 week
year_2 - each second year

next group , of numbers, 1_1 in your case - can be used if you set recurring events not for fixed date, but for some week-day, {counter}_{weekday}

sorry but i dont really understand.

can you give me some code example to parse the rec_type value ?

ex:
month_2_3_3_#1
year_1_4_3_#6
week_3___1,2#4

You can try to use
dhtmlx.com/blog/?p=612

Class, which is included in package can convert recurring dates between scheduler format and iCal format.

i looked very deeply the code that you gave me but still couldnt find what im looking.

i want an algorithm to parse that rec_type so i can add records individually to the db.

for ex: if it is, each 2 week monday, tuesday until 5 repeats it should be added 5 record to the db.

sorry if im being rude my english is not so good.

Hello,

To get array of dates (start date, end date) when recurring event will be occuring you can use getRecDates method.

Hope this helps.

Best regards,
Ilya

aww thank you so much. this is what im searching for a few days ! you saved my life :slight_smile: