Posted at

NSDateまわりのメモ

More than 3 years have passed since last update.

//今日の日付取得

NSDate *today = [NSDate date];

//日付を画面に表示する時のフォーマット作成

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

[dateFormat setDateFormat:@"yyyy/MM/dd HH:flag_mm:ss"];

//NSDateをNSStringに変換するまでの処理

NSDate *date = [NSDate date];

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

[formatter setDateFormat:@"yyyy/MM/dd HH:flag_mm:ss"];

NSString *dateStr = [formatter stringFromDate:date];