Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: storing and 'understanding' complex calendar events (including recurring events)

by Tobin Cataldo (Monk)
on May 26, 2006 at 20:31 UTC ( [id://551933]=note: print w/replies, xml ) Need Help??


in reply to Re: storing and 'understanding' complex calendar events (including recurring events)
in thread storing and 'understanding' complex calendar events (including recurring events)

Date:Manip is the best....

Check especially Date:Manip:ParseRecur()
Dates are stored in an array
my $start = '01/01/2006'; my $end = '12/31/2010'; my @fourth_tuesdays = ParseRecur("0:1*4:2:0:0:0", $start,$start,$end,) +; my @last_workday_of_every_month = ParseRecur("0:1*0:-1:0:0:0*PWD", $st +art,$start,$end,);


I haven't found anything nearly as good...
Tobin
  • Comment on Re^2: storing and 'understanding' complex calendar events (including recurring events)
  • Download Code

Replies are listed 'Best First'.
Re^3: storing and 'understanding' complex calendar events (including recurring events)
by schweini (Friar) on May 26, 2006 at 20:45 UTC
    so this would mean that pre-calculating dates would be my only real option, i guess? Assuming that i have a couple of hundred events, there would be no other way to simply call something like
    @events = showEvents( $date );
    ?
      The events would still need to be tied to a date though.
      I am not sure how to model this data exactly but I would approach it as event 1->N date property. Then you would calculate your date ranges for each date property once and connect events to dates. I am assuming some sort of relational db. Date:Manip is slower than some of the other options. But it is super powerful.
      Well, you either need to store the definition for the event or the complete list of events. Storing the definition and expanding it to the full list when needed keeps the database of events simple and easy to work on. On the other hand, it's probably going to be pretty slow when you need to go through the list and calculate if each event matches a given day. The opposite is true of storing an expanded list of dates for each event. It's a trade like everything else.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://551933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found