I want last 7 days (e.g. FRI,THU,WED,TUE,MON,SUN,SAT,FRI) in an array from current date of the system.If someone has any idea please help.Help would be appreciated.Thank you very much.
I want last 7 days (e.g. FRI,THU,WED,TUE,MON,SUN,SAT,FRI) in an array from current date of
Share
I am assuming that this is a general programming question and not specific to the iOS environment. If my assumption is incorrect, feel free to ignore this answer.
Build an array that has the days of the week.
Find the index of today’s day,
Loop backwards over the array copying the content to the array you are creating, when you get to zero set the index to 6 (assuming zero based arrays) and loop back to today’s day of the week.
Like this (this code is notional):
Hope this helps.