Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Now tested it.
The code
#!/usr/bin/perl use strict; use warnings; use DateTime; use DateTime::Event::Recurrence; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %T', ); my $datf = qq{2012-01-01 04:00:00}; my $datt = qq{2012-01-02 23:00:00}; my $start = $strp->parse_datetime($datf); my $end = $strp->parse_datetime($datt); my $day_set = DateTime::Event::Recurrence->daily( hours => [7, 22], ); my $it = $day_set->iterator ( start => $start->truncate(to=>"hour"), before => $end->truncate(to=>"hour"), ); while ( my $dt = $it->next() ) { print $dt->datetime(), "\n"; }
prints:
2012-01-01T07:00:00 2012-01-01T22:00:00 2012-01-02T07:00:00 2012-01-02T22:00:00

The desired output should be:
2012-01-01T08:00:00 2012-01-01T09:00:00 2012-01-01T10:00:00 2012-01-01T11:00:00 2012-01-01T12:00:00 2012-01-01T13:00:00 2012-01-01T14:00:00 2012-01-01T15:00:00 2012-01-01T16:00:00 2012-01-01T17:00:00 2012-01-01T18:00:00 2012-01-01T19:00:00 2012-01-01T20:00:00 2012-01-01T21:00:00 2012-01-01T22:00:00 2012-01-02T08:00:00 2012-01-02T09:00:00 2012-01-02T10:00:00 2012-01-02T11:00:00 2012-01-02T12:00:00 2012-01-02T13:00:00 2012-01-02T14:00:00 2012-01-02T15:00:00 2012-01-02T16:00:00 2012-01-02T17:00:00 2012-01-02T18:00:00 2012-01-02T19:00:00 2012-01-02T20:00:00 2012-01-02T21:00:00 2012-01-02T22:00:00
which is produced by your code from Re^5: A question to iterator in Datetime::Event::Recurrence but not the above code.
... This assumed that I understood everything correctly :-)
Greetings, VE

In reply to Re^2: A question to iterator in Datetime::Event::Recurrence by vagabonding electron
in thread A question to iterator in Datetime::Event::Recurrence by vagabonding electron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (9)
    As of 2014-07-30 11:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (230 votes), past polls