728x90
한국에 맞게 원하는 format으로 날짜 만들기
NSString * StringDate = @"2022-11-05";
NSDateFormatter * dateFormatter = [NSDateFormatter new];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"ko_KR"]];
string으로 되어 있는 날짜 형식에 맞게 format을 맞춘다
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate * date = [dateFormatter dateFromString: stringDate];
// 2022-11-05 00:00
이 'date'를 원하는 형식의 format으로 만들어 준다.
[dateFormatter setDateFormat:@"MM월 dd일 EEEE"];
NSString * myDate = [dateFormatter stringFromDate:date];
// 11월 05일 토요일
참고:
728x90
'iOS > iOS' 카테고리의 다른 글
UIBezierPath (0) | 2022.11.08 |
---|---|
UICollectionView (0) | 2022.11.04 |
UIPickerView (0) | 2022.11.02 |
navigation stack에서 특정 VC 삭제 (0) | 2022.11.02 |
UIScrollView (0) | 2022.11.01 |
댓글