NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
//Set the AM and PM symbols
[dateFormatter setAMSymbol:@"AM"];
[dateFormatter setPMSymbol:@"PM"];
//Specify only 1 M for month, 1 d for day and 1 h for hour
[dateFormatter setDateFormat:@"M/d/yyyy h:mm:ss a"];
NSDate *currentDate = [dateFormatter dateFromString:currentDateString];
NSLog(@"current date: %@", currentDate);
//Example of the format using the actual date
NSLog(@"%@", [dateFormatter stringFromDate:[NSDate date]]);
转自:http://cache.baiducontent.com/c?m=9d78d513d9981cee4fede5697d60c015694381136388c7140fc3933e84652b171171e2cb30226613d2b5372c4ae45e5c9baa6c65367337b6e8df893a9cfa85285eca7823706d913717c46adcdc4755d650914d98a40ee6cabb79d8e5c5d2af4353bc44040adfaf9c5b7003ca19e71541b5f08e4864054aadec4072fe2a6028ef6201a14788a26d7a40c1a8d2060a8568c760628ab274f66d43ec4ee0485b701afd09a60826776dbf5264b8137c42c9b601a6377d4b27b44eb2b3dceaaa09ca9cb16dcdedcbd969c877e6b3b6b827113605ed25c8ffe0f22a64335d86ddde609264abfa9af107a25fc0102ae00729702a8f7c94f4db0ab23d09b2&p=8b2a9701c8990aff57ee947c56418a&newp=8a3bc54ad5c343f00da9c7710f4898231610db2151d6d24a2a90&user=baidu&fm=sc&query=ios+%BD%ABMM%2Ddd%2Dyyyy+hh%3Ass+PM+%D7%AA%B3%C9yyyy%2DMM%2Ddd+hh%3Ass+PM&qid=9c830c2a000887b7&p1=10