in reply to Grouping by week
Want the brutal-but-effective way? Don't even try to parse the date. Do a table lookup instead. Precalculate a mapping of date string to week number, and load it into a hash a program startup. Then you can map the date string to a week number quickly, without having to break the date into pieces and do math on them. In the grand scheme of things, there aren't that many dates in a year, so space isn't really an issue.
Just make sure that the your definition of 'week' matches that the SLA, particularly when a week crosses a year boundary. Occassionally the legal definition gets odd.
|
|---|