iPhone NSDate eg. next Friday

前端 未结 5 930
予麋鹿
予麋鹿 2021-01-14 03:22

I want to create a function which results the date of next Friday but I have no plan how to do it. Has anyone a good hint to me ?

5条回答
  •  爱一瞬间的悲伤
    2021-01-14 03:46

    E.g. Get current date using NSDate, then use 'components>fromDate:' from NSCalendar to get the NSDateComponents, then add the time difference to next Friday and create a new NSDate and Bob's is your uncle.

提交回复
热议问题