in reply to Re^3: What is the best way to get a list of all Mondays until the end of the year?
in thread What is the best way to get a list of all Mondays until the end of the year?
Sure - but the Mondays we're interested in would probably need to be in local timezone and DST, not GMT. I'm not really sure the code would fail, but I wouldn't bet I get the correct list of dates regardless when the calculation is done either.
I'm not sure the back-and-forth between localtime and gmtime works OK for this calculation - but consider that the Mondays surrounding a DST change date are 7*86400 +- 3600 seconds apart in 'real life' - using 7*86400 instead might place me a day ahead or behind if I'm somehwere near midnight when making the calculation.
Just a warning about the not-at-all-trivial datetime calculations.
Krambambuli
---
I'm not sure the back-and-forth between localtime and gmtime works OK for this calculation - but consider that the Mondays surrounding a DST change date are 7*86400 +- 3600 seconds apart in 'real life' - using 7*86400 instead might place me a day ahead or behind if I'm somehwere near midnight when making the calculation.
Just a warning about the not-at-all-trivial datetime calculations.
Krambambuli
---
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: What is the best way to get a list of all Mondays until the end of the year?
by Rhandom (Curate) on Aug 19, 2008 at 19:20 UTC |
In Section
Seekers of Perl Wisdom