我有这样的约会时间
2012-01-01 10:00:00
我只需要像这样将其转换为日期
2012-01-01
谁能帮我这是我的代码
NSDate *adate = objIStruct_Conference.m_DtDate;
NSLog(@"DATE========%@",objIStruct_Conference.m_DtDate);
NSString *DateString = [NSString stringWithFormat:@"%@", adate ];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]];
[formatter setDateFormat:@"yyyy:MM:dd"];
NSLog(@"NEW DATE====%@", [formatter stringFromDate:adate]);
[formatter release];
我得到 DATE===== 2012-01-01 10:00:00 ,新日期=====(null)