[Solved] Convert time format to UTC format [closed]


Try This.

NSString *strIncomingDate = @"29-Mar-2018 05:58:33";

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[dateFormat setDateFormat:@"dd-MMM-yyyy hh:mm:ss"];
NSDate *date = [dateFormat dateFromString:strIncomingDate];

NSDateFormatter *dateFormat1 = [[NSDateFormatter alloc] init];
[dateFormat1 setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[dateFormat1 setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
NSString *strDesire = [dateFormat1 stringFromDate:date];

10

solved Convert time format to UTC format [closed]