i need to convert some date that i have in NSString
to NSString
in this format: yyyy-MM-dd HH:mm:ss zzz
i write this code:
try this method..
-(NSString *)getUTCFormateDate:(NSString *)localDate
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd/MM/yyyy"];
NSDate *dateFormatted = [dateFormatter dateFromString:localDate];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:dateFormatted];
[dateFormatter release];
return dateString;
}
i think, Here GMT show Standard time and GMT and UTC both are same. please look on below links: http://wwp.greenwichmeantime.com/ http://www.worldtimeserver.com/convert_time_in_UTC.aspx
thanks