I am writing a method that takes string and returns string. I am trying to use it in another method.
- (NSString*) formatDate:(NSString*) showStartDateTime
{
NSTimeZone *tz = [NSTimeZone timeZoneWithName:@"UTC"];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:tz];
[dateFormatter setDateFormat:@"EEE MM/dd/yyyy"];
NSDate*dattt=[dateFormatter dateFromString:showStartDateTime ];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString*tempo2= [dateFormatter stringFromDate:dattt];
return tempo2;
}
This is how I am using it. [self formatDate:@"Fri 08/08/2014"] is it a correct way to use it?
NSString *hellostring=[self formatDate:@"Fri 08/08/2014"];
NSLog(@"%@",hellostring);
I know it does not work. Any suggestion is appreciated.