創建的NSDate我有一個NSString
這樣的:@"3/15/2012 9:15 PM"
,我想將其轉換爲NSDate
,我做了這樣的:從字符串
NSString *str [email protected]"3/15/2012 9:15 PM";
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"mm/dd/yyyy HH:mm"];
NSDate *date = [formatter dateFromString:];
NSLog(@"%@", date); // date = null
你能幫我請,謝謝。
的[字符串轉換爲的NSDate]可能重複(http://stackoverflow.com/questions/2311421/convert-string- to-nsdate) – 2012-03-19 18:09:04