NSDateFormatter
*dateFormatter=[[
NSDateFormatter
alloc
]
init
];
[dateFormatter
setDateFormat
:
@"yyyy-MM-dd HH:mm:ss"
];
NSDate
* senddate=[
NSDate
date
];
NSDate
*endDate = [dateFormatter
dateFromString
:
@"2014-6-24 00:00:00"
];
NSDate
*senderDate = [dateFormatter
dateFromString
:[dateFormatter
stringFromDate
:senddate]];
NSTimeInterval
time=[endDate
timeIntervalSinceDate
:senderDate];
int
days = ((
int
)time)/(
3
6
0
0
*
2
4
);
int
hours = ((
int
)time)%(
3
6
0
0
*
2
4
)/
3
6
0
0
;
int
minute = ((
int
)time)%(
3
6
0
0
*
2
4
)
6
0
0
/
6
0
;
if
(days <=
0
&&hours; <=
0
&&minute; <=
0
)
dateContent=
@"0天0小时0分钟"
;
else
dateContent=[[
NSString
alloc
]
initWithFormat
:
@"%i天%i小时%i分钟"
,days,hours,minute];