1

I need to convert current date into UTC format, i have done the following and got the correct UTC date, below is my source code

NSDate *currDate = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
NSString *dateString = [dateFormatter stringFromDate:currDate];
NSLog(@"%@",dateString);

I am getting date in this format 2013-05-01 23:11:02 GMT only i want UTC name instead on GMT what conversion do i need to do for this.

user741076
  • 63
  • 1
  • 3
  • 9

1 Answers1

1

If your just concerned with the text than do a string replace:

 NSString *convString = [dateString stringByReplacingOccurrencesOfString:@"GMT" withString:@"UTC"];
ninehundreds
  • 1,097
  • 2
  • 21
  • 43