Monday, December 13, 2010

NSDateFormatter:Convert NSDate to NSString description

Convert a NSDate to string in format "yyyy-MM-dd"

NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];
NSLog(dateString);

No comments:

Post a Comment