Get the Day from the date in iOS sdk

后端 未结 7 547
无人共我
无人共我 2021-01-16 12:36

In my app, want to get the day (i.e. Sunday, Monday,etc.) from the date.

My code is as follow:

NSDate *currentDate = [NSDat         


        
7条回答
  •  既然无缘
    2021-01-16 13:07

    mydate = [NSDate date];
    NSDateFormatter *dt2 = [ [NSDateFormatter alloc] init];
    [dt2 setDateFormat:@"EEEE"];
    
    NSString *day = [[NSString alloc] initWithFormat:@"%@",[dt2 stringFromDate:mydate]];
    

提交回复
热议问题