Wednesday, 27 February 2013

To convert date format from string into any date format in IOS



NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"yyyy-MM-dd"];
            NSString* string=@"2013-2-12"; 
            NSDate *dat = [formatter dateFromString:string];
            
            [formatter setDateFormat:@"dd MM yyyy"];  // here u can change to get any format and print dat