Tag: Objective-C/日付と時刻
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setTimeStyle:NSDateFormatterFullStyle]; [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZ"]; NSDate *date = [formatter dateFromString:@"2009-12-05T20:26:00+09:00"];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%Y/%m/%d %H:%M:%S" allowNaturalLanguage:FALSE] autorelease]; NSDate* date = [NSDate date]; NSString* dateStr = [formatter stringFromDate:date];