日期:"Mar 13, 2013 05:30pm"。我想轉換成NSDate對象。
代碼如下,但是失敗了。
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMM:dd, YYYY hh:mm:aa"];
date=[dateFormatter dateFromString:dateString];
NSString *stringDate = @"Mar 13, 2013 05:30pm";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMM dd, yyyy hh:mmaa"];
NSDate *date=[dateFormatter dateFromString:stringDate];
NSLog(@"Date : %@",date);