[objective-c]NSDateからNSString生成
NSDateからNSString生成
-(NSString*)getStringByDate:(NSDate*)_date{ NSDateFormatter*df=[[NSDateFormatter alloc] init]; NSCalendar*cal=[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [df setCalendar:cal]; [df setDateFormat:@"yyyy/MM/dd HH:mm:ss"]; NSString* str=[df stringFromDate:_date]; [cal release]; [df release]; return str; }