Linked Questions

Popular Questions

How to get days in a week from today in objective c

Asked by At

I am trying to get the days of a week in reference to their date. Ex.: 14th October is a Wednesday. I am creating a collection view cell and displaying the date as follows. enter image description here

In the 14th cell it would display Wednesday, but how to get the next day as Thursday, then Friday...and so on.

I have got todays date and which day it is as follows,

day = [components day];
week = [components month];
year = [components year];
weekday = [components weekday];
NSString *string = [NSString stringWithFormat:@"%ld.%ld.%ld", (long)day, (long)week, (long)year];
NSDate *todayDate = [NSDate date]; // get today date
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEEE"];
NSString *convertedDateString = [dateFormatter stringFromDate:todayDate];// here convert date in
NSLog(@"Today formatted date is %@",convertedDateString);

And i have found this method online, which returns the days in string when you pass the integer, but i am having trouble in this too, not understanding which integer to pass every time so I get different strings.

static inline NSString *stringFromWeekday(int weekday){
static NSString *strings[] = {

return strings[weekday];


Related Questions