0
*[email protected]"21/07/2016";
[email protected]"20/08/2016";
NSComparisonResult result;
result = [date1 compare:date2];*
그것은 단지 날짜를 비교하고 지금이이 달 또한 올해 당신이 필요로하는아이폰 OS에서의 년, 월 사용하여 두 날짜를 비교하는 방법
*[email protected]"21/07/2016";
[email protected]"20/08/2016";
NSComparisonResult result;
result = [date1 compare:date2];*
그것은 단지 날짜를 비교하고 지금이이 달 또한 올해 당신이 필요로하는아이폰 OS에서의 년, 월 사용하여 두 날짜를 비교하는 방법
를 사용하여 날짜 비교하려는이 작은 출력을 날짜 1을 보여 문자열을 날짜로 변환 한 다음 비교하면 올바른 결과를 얻을 수 있습니다.
아래 코드를 시도하십시오.
NSString *[email protected]"21/07/2016";
NSString *[email protected]"20/08/2016";
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"dd/MM/yyyy"];
NSDate *dtOne=[format dateFromString:strTimeIn];
NSDate *dtTwo=[format dateFromString:strTimeOut];
NSComparisonResult result;
result = [dtOne compare:dtTwo];
귀하의 date1 날짜 2는 나데 또는 문자열입니까? –
그 문자열 값 – vignesh