Tags: #NSDate #NSDateFormatter #Tutorial #IOS #NSDate Format
Now you can use above characters to format your NSDate in iPhone SDK
using the class NSDateFormatter.
Below are the steps that shows you how to use NSDateformatter.
Step 1: Create an instance of NSDateFormatter.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
Step 2: Set date format(format in which you want to display your date)
[dateFormatter setDateFormat:@"ddMMyyyy"];
Step 3: Converting your NSDate into string
NSString *textDate = [NSString stringWithFormat:@"%@",
[dateFormatter stringFromDate:[NSDate date]]];
Step 4: Print your date string in NSLog to see the output.
NSLog(@"Date %@",textDate);
Step 5: Release NSDateFormatter instance.
[dateFormatter release];