0

Problem: I am organizing objects into groups (weeks) that are classified by their date property to the most recent Monday that has past at 12:00. Given an NSDate, how can I find the most recent Monday at 12:00AM in swift?

Tried: I tried making a for loop and going back until the nearest Monday and then make a new NSDate object and put the time to 12:00AM but for whatever reason I cannot get it to work in swift.

Thanks in advance!

Joseph
  • 35
  • 5
  • Update your question with you have tried and explain what results your get and what results you expect. – rmaddy Jan 11 '16 at 18:59
  • I had a similar problem some time ago. Unfortunately I don't have a complete solution for you but I would use NSDateComponents and NSCalendar http://nshipster.com/nsdatecomponents/ – tmpz Jan 11 '16 at 19:00
  • beyond what you have tried, please show some sample input and output - what is *"the most recent Monday that has past at 12:00"*? – luk2302 Jan 11 '16 at 19:01
  • http://stackoverflow.com/a/33398047/2303865 does exactly what you want – Leo Dabus Jan 11 '16 at 19:17
  • thanks I don't know how i missed this – Joseph Jan 11 '16 at 19:42

0 Answers0