in reply to Re^3: Is there an easy way to get the start date of the current week?
in thread Is there an easy way to get the start date of the current week?

Ah! Okay, so finding, installing and working out how to use 3000 lines/95k of code is: "just subtracting the right number of days". Gotcha.

  • Comment on Re^4: Is there an easy way to get the start date of the current week?

Replies are listed 'Best First'.
Re^5: Is there an easy way to get the start date of the current week?
by james2vegas (Chaplain) on Aug 21, 2010 at 15:19 UTC
    Time::Seconds and Time::Piece are core modules, they do not need to be installed, and Date::Calc, already mentioned in this thread, is used to calculate the arbitrary date. But sure, how about this, then?

    Update: changed hour to noon, instead of midnight, thanks daylight saving time (now works for the week of March 14 2010, thanks ikegami)
    Update: Adding Time::Local, to make the call a little more clear:

      The numbers are for Date::Calc on its own. You didn't appear to be using Time Piece or Time::Seconds, so I didn't count them.

        ONE_DAY is from Time::Seconds and the object interface to the return value of localtime (instead of accessing array elements by index) is from Time::Piece. Date::Calc was used since its Mktime method accepts date and time fields more obviously than Time::Local's timelocal does, and it had been mentioned in the thread already. It was either that or DateTime which is heavier, but is the Date/Time module I usually use. I guess Time::Local is a fine, if not completely intuitive, choice.