Revision: 52001
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 10, 2011 23:21 by ggrngg
Initial Code
NSDateFormatter *tempFormatter = [[[NSDateFormatter alloc]init]autorelease]; [tempFormatter setDateFormat:@"dd-MM-yyyy HH:mm:ss"]; NSDate *startdate = [tempFormatter dateFromString:@"15-01-2011 09:00:00"]; NSLog(@"startdate ==%@",startdate); NSDateFormatter *tempFormatter1 = [[[NSDateFormatter alloc]init]autorelease]; [tempFormatter1 setDateFormat:@"dd-MM-yyyy HH:mm:ss"]; NSDate *toDate = [tempFormatter1 dateFromString:@"20-01-2011 09:00:00"]; NSLog(@"toDate ==%@",toDate); int i = [startdate timeIntervalSince1970]; int j = [toDate timeIntervalSince1970]; double X = j-i; int days=(int)((double)X/(3600.0*24.00)); NSLog(@"Total Days Between::%d",days);
Initial URL
http://stackoverflow.com/questions/6069480/find-total-number-of-days-between-two-dates-in-iphone
Initial Description
Initial Title
Calendar - difference between two dates
Initial Tags
date
Initial Language
Objective C