开发者

attempting to parse a ICal RRule string

开发者 https://www.devze.com 2023-03-01 18:44 出处:网络
RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=TU,WE,FR;UNTIL=20110713T075959Z;WKST=SU I\'m building a drupal site and the Date module outputs this code, which I need to display on a page in a more readable for
RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=TU,WE,FR;UNTIL=20110713T075959Z;WKST=SU

I'm building a drupal site and the Date module outputs this code, which I need to display on a page in a more readable format.

I jus开发者_运维问答t want to get the days and the end date which is the UNTIL.

I'm not sure how to approach it. I'm not very good with regular expressions.


I would just cheat and parse it as a query string:

parse_str(strtr($YOUR_STRING, ';', '&'), $data);

And then you can further process it, e.g. split the BYDAY:

$byDays = explode(',', $data['BYDAY']);
0

精彩评论

暂无评论...
验证码 换一张
取 消