Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Determing Week Ranges between given date range?

by mojotoad (Monsignor)
on Oct 12, 2010 at 21:54 UTC ( #864963=note: print w/replies, xml ) Need Help??


in reply to Re^3: Determing Week Ranges between given date range?
in thread Determing Week Ranges between given date range?

Sort of...actually, I cribbed that code from something I had lying around -- that code was designed around the convention of 0=Mon, 1=Tue, etc. But I forgot, oops.

After fixing that assumption, this also works (closer to the form I originally used). 0=Sun, 1=Mon ... :

days => ($first_dow + (6 - $week_s->dow())) % 7
Thanks for spotting it.

Cheers,
Matt

Replies are listed 'Best First'.
Re^5: Determing Week Ranges between given date range?
by ikegami (Pope) on Oct 12, 2010 at 22:51 UTC
    Yeah, that's functionally equivalent, but I wanted to keep the two halves of the equation separate (calculating the last day of the week and calculating the number of days until the last day of the week). In mine, ($first_dow + 6) can be replaced with $last_dow.
      How dare you introduce clarity!

      Cheers,
      Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://864963]
help
Chatterbox?
[choroba]: but still, small-talk about smuggling guns and how Trump is great with US expats isn't my cup of tea
[LanX]: brutal beer?
[LanX]: met a Canadian yesterday, he suggested building a wall and let the US pay for it
[choroba]: No, but lots of pictures of the Agent Orange victims, plus some deformed foeti
[LanX]: ugh

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-02-26 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (371 votes). Check out past polls.