in reply to Convert Week Of Year to Date

There are so many ways this could be done using Date::Manip, all of them slightly complex... ;)

But there is one other complexity to consider not related to manipulating the particular date module you use. And that is the concept of falling back to the starting date for a given week as the header for your week's summary.

What happens if the first day of the year is Wednesday, and you summarize everything that occurred in the first week of the year, given that the weeks begins on Sunday? You fall back to a previous year. Is this desired behavior?

What happens if the first day of the month is Wednesday, and you summarize everything that occurred in the first week of the month? ...same sort of problem. Things that happened on Wednesday April 1st will fall under the heading of the last Sunday in March. Again, is this desired behavior?

Some companies will actually use what they call a 4-5-4 calendar, where years always start on Sunday, and months always start on Sunday. This simplifies such problems. But then your company months start and end a day or two or three differently from real-world months. It takes a little getting used to, but ensures that when you're looking at everything that happened in week 1 of the year, week 1 started on a Sunday, and the entire week falls into the same year. And you can look at weeks of months in the same way; weeks never span months under such a calendar.


Dave