Situation:
I have a silly database table (not mine) storing CMIS Facility week numbers and their starting dates. For those of you unfamiliar with this system, the reason week numbers are different to normal people's week numbers is because these are academic week numbers. So I can't use the built-in functions.
The current structure looks similar to this:
copyrawstyler
ID SetID WeekNumber StartDate
--------- ---------------- ---------------------- ----------------------------
1 2011/2012 1 2011-07-18 00:00:00
...
52 2011/2012 52 2012-07-09 00:00:00
- ID SetID WeekNumber StartDate
- 1 2011/2012 1 2011-07-18 00:00:00
- ...
- 52 2011/2012 52 2012-07-09 00:00:00
Joe you're an idiot!
You might say to me why not run the CMIS Facility application and add a new set, it will put these dates in automatically.
Herein lies the problem
The reason I'm doing this is for another system which decided to "cleverly" use the exports from CMIS Facility so that all the weeks correspond to the rest of the academic data. Unfortunately the developer wrote a system he felt would last the rest of his PhD degree, it's a shame he started in his last year. He used functions to mktime and simulate the dates. A function goes in with a normal calendar date and returns an academic week number and the week commencing date.
Problem?
The 1st of January 2010 was a Friday. The 1st of January 2011 was a Saturday. The developer felt that as long as you adjust the script each year you could make the system last another year. Shame he also forgot the academic year ends halfway in a normal people's calendar, so you actually have to adjust this twice a year.
Category: MySQL :: Article: 342