How To Create a lookup Table with an NSDate for weekly range (over 5 year period)
- by EarlyMan
Unsure how to best achieve this.
NSDate *date = [NSDate date];
I need to do a lookup on the date and return a string value.
12/17/2011 < date < 12/23/2011 return "20120101"
12/24/2011 < date < 12/30/2012 return "20120102"
12/31/2011 < date < 01/06/2012 return "20120201"
...
10/20/2012 < date < 10/26/2012 return "20122301"
...
11/02/2013 < date < 11/08/2013 return "20132301"
..
for 5 years... for each week
date can be any date until Dec. 2017.
I do not know the logic behind the return strings so I can't simply calculate the string based on the date. The return string (converted to NSDate in the model) is used successfully as my section for my fetchedresultscontroller.
I am not sure how to create a lookup table based on an NSDate or if I need some monster if/case statement.