我們如何才能獲得當天星期幾(星期一至星期日)的特定日期?例如我想了解這個星期日的日期或上週一的日期。如何從本週的星期幾名稱中獲得具體日期
編輯:在這裏,我如何與的@juniperi的鏈接
//To get current day
CFAbsoluteTime at = CFAbsoluteTimeGetCurrent();
CFTimeZoneRef tz = CFTimeZoneCopySystem();
SInt32 currentWeekdayNumber = CFAbsoluteTimeGetDayOfWeek(at, tz);
//We are adding or substracting from the day we want and add to the current date
NSDate *now = [NSDate date];
int daysToAdd = theDayNumberWeWant - currentWeekdayNumber;
NSDate *newDate1 = [now dateByAddingTimeInterval:60*60*24*daysToAdd];
http://stackoverflow.com/questions/4269093/how-do-i-get-the-day-of-the-week-in-objective-c?rq=1 – juniperi
感謝,這是有益的。 – birdcage