Accurate date formate and compare date in iphone dev?

后端 未结 2 549
借酒劲吻你
借酒劲吻你 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:31

    NSString to NSDate conversion

        NSString *dateString = @"6:30 18 Oct";
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"hh:mm dd/MMM"];
        NSDate *dateFromString = [[NSDate alloc] init];
        dateFromString = [dateFormatter dateFromString:dateString];
        [dateFormatter release];
    

提交回复
热议问题