question related to conversion from NSDate to NSString
NSString *abc = @"2009-12-12 16:25:00";
i have 1 string in this format as shown above.
NSDate *currentDate = [NSDate date]; now i want currentDate in also this format as specified 2009-1开发者_运维问答2-12 16:25:00
and also i want to convert this currentDate from NSdate to NSString format with specified thisformat 2009-12-12 16:25:00
help me
NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString* golly = [dateFormatter stringFromDate:[NSDate date]];
Use NSDateFormatter
.
精彩评论