Accurate date formate and compare date in iphone dev?

后端 未结 2 527
借酒劲吻你
借酒劲吻你 2021-01-24 08:29

I am new in iphone, i want to change string into accurate date-formate which i couldn\'t done this for last 2 hrs. I have string like(17:30 18 Oct) and want to convert this in a

2条回答
  •  生来不讨喜
    2021-01-24 09:13

    Try this

        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"hh:mma dd/MMM"];
        NSString *dateString = [dateFormat stringFromDate:today];
        NSLog(@"date: %@", dateString);
        [dateFormat release];
    

提交回复
热议问题