[objective-c]日付文字列まとめ

日付文字列まとめ

_currentDate =  [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone systemTimeZone] secondsFromGMT]];

NSDateFormatter* form = [[NSDateFormatter alloc] init];
[form setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[form setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
_currentDatetimeString = [form stringFromDate: _currentDate ];
[form setDateFormat:@"yyyy-MM-dd"];
_currentDateString = [form stringFromDate: _currentDate ];
[form setDateFormat:@"yyyy-MM"];
_currentYMString = [form stringFromDate: _currentDate ];
[form setDateFormat:@"HH:mm:ss"];
_currentTimeString = [form stringFromDate: _currentDate ];