开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜