//計算兩個日期之間的天數
+ (NSInteger) calcDaysFromBegin:(NSDate *)beginDate end:(NSDate *)endDate
{
//創建日期格式化對象
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
//取兩個日期對象的時間間隔:
//這裏的NSTimeInterval 並不是對象,是基本型,其實是double類型,是由c定義的:typedef double NSTimeInterval;
NSTimeInterval time=[endDate timeIntervalSinceDate:beginDate];
int days=((int)time)/(3600*24);
//int hours=((int)time)%(3600*24)/3600;
//NSString *dateContent=[[NSString alloc] initWithFormat:@"%i天%i小時",days,hours];
return days;
}