'NSDate'에 해당되는 글 1건

  1. 2012.09.09 [iOS] NSDate 를 이용한 파일 이름 생성
iOS2012. 9. 9. 19:24

- (NSString *)getFileName {

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@"yyyyMMdd_hhmmss_"];

NSDate *date = [[NSDate alloc] init];

NSString *fileName = [NSString stringWithFormat:@"%@%@",

  [dateFormatter stringFromDate:date],

  [[[NSString stringWithFormat:@"%f", [[NSDate date]timeIntervalSince1970]] componentsSeparatedByString:@"."] objectAtIndex:1]];

[date release];

[dateFormatter release];

return fileName;

}

Posted by 다오나무