
Hi, What is the correct way of writing NSDateFormatter in string format.
Thanks.

For current Date in NSDate Format
-(void) setCurrentDate:(NSDate* newDate){
[self.currentDate release];
self.currentDate = newDate;
[self.currentDate retain];
[self updateView];
}

See the given code to convert NSDateFormat to NSString format in iPhone/iPad objective c programming.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy"]; //If you want to set time zone [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"..."]]; NSString *stringFromDate = [formatter stringFromDate:myNSDateInstance];

In objective c, we use NSDate to show the Current Date and Time. but sometime we also use formatters ..because formatters interpret and create strings that represent other data types. For example to show the date in string format we'll use NSDateFormatter instead of NSDate.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.