How do I take a date and extract the day in iOS"

前端 未结 5 1542
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 16:15

I have a webservice that returns the date in this format:

2013-04-14

How do i figure out what day this corresponds to?

5条回答
  •  时光说笑
    2020-12-19 17:18

    If you have 2013-04-14 stored in a NSString called date, then you can do this...

    NSArray *dateComponents = [date componentsSeperatedByString:@"-"];
    NSString *day = [dateComponents lastObject];
    

提交回复
热议问题